Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

.map with index javascript

const list = [ 'h', 'e', 'l', 'l', 'o'];
list.map((currElement, index) => {
  console.log("The current iteration is: " + index);
  console.log("The current element is: " + currElement);
  console.log("
");
  return currElement; //equivalent to list[index]
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #index #javascript
ADD COMMENT
Topic
Name
5+7 =