8 3 1 common array methods 2f 2f includes examples 28 includes 29

Solutions on MaxInterview for 8 3 1 common array methods 2f 2f includes examples 28 includes 29 by the best coders in the world

showing results for - "8 3 1 common array methods 2f 2f includes examples 28 includes 29"
Sofia
13 Oct 2016
1//The general syntax for this method is:
2arrayName.includes(item)
3
4/*This method checks if an array contains the item specified in the
5parentheses (), and returns true or false.*/
6
7let charles = [1, 7, 5, 9, 5];
8let otherArr = ['hello', 'world!'];
9
10console.log(charles.includes(5));
11
12console.log(otherArr.includes('hi'));
13
14//true
15//false