Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Indexof method javascript

// indexOf method only requires a single value 
// and returns the index of the FIRST value found in array
const cities = [
  "Orlando",
  "Dubai",
  "Denver",
  "Edinburgh",
  "Chennai",
  "Accra",
];

console.log(cities.indexOf("Chennai"));
// expected output is 4
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Indexof #method #javascript
ADD COMMENT
Topic
Name
3+6 =