js code to check if a number is in array code example
Example 1: get if there is a value in an array node js
myArray = Array(/*element1, element2, etc...*/);
// If the array 'myArray' contains the element 'valueWeSearch'
if(myArray.includes(valueWeSearch))
{
// Do something
}
Example 2: javascript is int in array
[1, 2, 3].includes(2); // true
[1, 2, 3].includes(4); // false
[1, 2, 3].includes(1, 2); // false (second parameter is the index position in this array at which to begin searching)