Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Find Smallest Number by function in Javascript

function smallestNumber(first, second, third) {
    if (first < second && first < third) {
        return first;
    } else if (second < first && second < third) {
        return second;
    } else {
        return third;
    }
}
const num1 = 100;
const num2 = 120;
const num3 = 80;
console.log(smallestNumber(num1, num2, num3));
//Output: 80
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Find #Smallest #Number #function #Javascript
ADD COMMENT
Topic
Name
3+6 =