what is 'array.includes' function in JavaScript

Array includes is a feature introduced in JavaScript es16 or es2017 it's similar to a pre existing function array.indexof() as compared to array.indexof() array.includes() function notably returns a true  boolean on matched value, and false if value not matched

Examples on how to use 'array.includes()' function

The first argument is the value to be looked upon in an array;

const arr = ['dogs', 'cats', 'snakes']

arr.includes('liars')
// false

arr.includes('snakes')
// true

arr.includes('lizards')
// false

I hope you get the concept

Comments

Popular posts from this blog

How to set content disposition header for nginx server to force content download

How to create zip archives in nodejs

How to make a Snake Game using JavaScript and html5

How to draw clouds on HTML5 Canvas

How to resume a suspended web audio api context