Q:

Write a JavaScript program to test whether an array of integers of length 2 does not contain 1 or a 3

0

Write a JavaScript program to test whether an array of integers of length 2 does not contain 1 or a 3.

All Answers

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

function is13(nums) {
  if (nums.indexOf(1) == -1 && nums.indexOf(3) == -1){
      return true;
  } else {
      return false;
  }
}

console.log(is13([7, 8]));
console.log(is13([3, 2]));
console.log(is13([0, 1])); 

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