Q:

Write a JavaScript program to check whether a given number is presents in the range 40..10000

0

Write a JavaScript program to check whether a given number is presents in the range 40..10000. 
For example 40 presents in 40 and 4000

All Answers

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

function test_digit(x, y, n) 
  {    
    if (n < 40 || n > 10000)
      return false;
    else
      if (n >= x && n <= y)
        return true;
      else
        return false;
  }
console.log(test_digit(40, 4000, 45));  
console.log(test_digit(80, 320, 79));  
console.log(test_digit(89, 4000, 30));

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