Skip to content

Instantly share code, notes, and snippets.

@Louiefigz
Created July 1, 2017 22:51
Show Gist options
  • Select an option

  • Save Louiefigz/fdeea29e5ab51d15c24848a8d5f62274 to your computer and use it in GitHub Desktop.

Select an option

Save Louiefigz/fdeea29e5ab51d15c24848a8d5f62274 to your computer and use it in GitHub Desktop.
var cars = ["honda", "hondai", "dodge", "jeep"]
//USING forEach()
cars.forEach(function(car){
console.log(car);
})
//=> honda
//=>hondai
//=>dodge
//=>jeep
cars.forEach((car)=>{
console.log(car)
})
//=> honda
//=>hondai
//=>dodge
//=>jeep
cars.forEach((car)=>
console.log(car)
)
//=> honda
//=>hondai
//=>dodge
//=>jeep
// ES2015
cars.map(function(car){
console.log(car)
})
// ES6 ARROW FUNCTION
cars.map( car =>
console.log(car)
)
//=> honda
//=>hondai
//=>dodge
//=>jeep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment