Answers for "hoe to determine larger number in js"

1

js check which number is larger

//Which number is larger
function whichIsLarger(num1 , num2){
	return num1 > num2 ? 'num1': num1 < num2 ? 'num2' : 'neither';
}

console.log(whichIsLarger(10, 8)); //num1
console.log(whichIsLarger(11, 11));//neither
console.log(whichIsLarger(-1, 5)); //num2
Posted by: Guest on February-17-2021

Code answers related to "hoe to determine larger number in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language