Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

javascript function loop through array

//function arrayLooper will loop through the planets array
const planets = ["Mercury", "Venus", "Earth", "Mars"];

const arrayLooper = (array) => {
  for (let i = 0; i < array.length; i++) {
    console.log(array[i]);
  }
};
arrayLooper(planets);
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #javascript #function #loop #array
ADD COMMENT
Topic
Name
4+5 =