Array.include()

From ZCubes Wiki
Jump to navigation Jump to search

Array.include(valueToFind[, fromIndex])

This function determines whether an array include a certain value, returning true or false as appropriate.The result is true if the given value is found within the array otherwise false. Values of zero are all considered to be equal, regardless of sign. So -0 is considered to be equal to both 0 and +0, but false is not considered to be the same as 0.

[1, 2, 3].include(2)      
true
[1, 2, 3].include(4)      
false
[1, 2, 3].include(3, 3)  
false
[1, 2, 3].includes(3, -1) 
 true
[1, 2, NaN].includes(NaN) 
true

See Also

Explode

implode