Answers for "8.3.1. Common Array Methods // includes Examples (.includes)"

0

8.3.1. Common Array Methods // includes Examples (.includes)

//The general syntax for this method is:
arrayName.includes(item)

/*This method checks if an array contains the item specified in the
parentheses (), and returns true or false.*/

let charles = [1, 7, 5, 9, 5];
let otherArr = ['hello', 'world!'];

console.log(charles.includes(5));

console.log(otherArr.includes('hi'));

//true
//false
Posted by: Guest on June-14-2021

Code answers related to "8.3.1. Common Array Methods // includes Examples (.includes)"

Code answers related to "Javascript"

Browse Popular Code Answers by Language