Q:

Write a JavaScript program to test whether a given integer is greater than 15 return the given number, otherwise return 15

0

Write a JavaScript program to test whether a given integer is greater than 15 return the given number, otherwise return 15.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

function test_fifteen(num) 
{
    while(num<15){
        num++;
    }
    return num;
}
console.log(test_fifteen("123"));
console.log(test_fifteen("10"));
console.log(test_fifteen("5"));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now