Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript includes

// check if an array INCLUDES a certain value

//array for includes()
let numbers = [1, 2, 3, 4, 5]

// either true or false 
numbers.includes(2) // returns true, the numbers array contains the number 2

numbers.includes(6) // returns false, the numbers array DOESNT contain the number 6
 
PREVIOUS NEXT
Tagged: #javascript #includes
ADD COMMENT
Topic
Name
1+1 =