Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

lastindexof method javascript

// lastIndexOf only requires a single value 
// and returns the index of last instance of value found in array

const cities = [
  "Orlando",
  "Denver",
  "Edinburgh",
  "Chennai",
  "Denver",
  "Eskisehir",
  "Yokohama",
  "Denver",
  "Chennai",
];

console.log(cities.lastIndexOf("Denver"));
// Expected output is 7
 
PREVIOUS NEXT
Tagged: #lastindexof #method #javascript
ADD COMMENT
Topic
Name
5+3 =