//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
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter