Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

includes method javascript

// .includes can be used to check if an array includes a 
// certain value. This method takes a single value an argument the item 
// you're checking for, and returns either true or false.
const cities = [
  "Orlando",
  "Dubai",
  "Edinburgh",
  "Chennai",
  "Denver",
];

console.log(cities.includes("Burlington"));
//Expected output is false
console.log(cities.includes("Denver"));
//Expected output is true
 
PREVIOUS NEXT
Tagged: #includes #method #javascript
ADD COMMENT
Topic
Name
4+2 =