includes() method

PHOTO EMBED

Thu May 12 2022 23:21:25 GMT+0000 (Coordinated Universal Time)

Saved by @Luduwanda #javascriptreact

//Checks whether element exists in array

const myArray = [2,3,4,5,6]

myArray.includes(2)
//true
myArray.includes(8)
//false

const newArra = [{id:1}, {id:2}, {id:3}]
//undefined

//first argument: searched number, second argument: index
//so: is at index 3 the number 2?
myArray.includes(2,3)
//false
content_copyCOPY