Created
September 15, 2020 01:05
-
-
Save jerlyrosa/d10fe9d038e3b1f965ff4f9d876135da to your computer and use it in GitHub Desktop.
Funcionamiento del metodo Array.prototype.forEach()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Array.prototype.forEach() | |
// El método forEach() ejecuta la función indicada una vez por cada elemento del array. | |
const arr = ['lunes', 'Martes', 'Miercoles', 'Jueves','Viernes', 'Sabado', 'Domingo']; | |
const newList = arr.forEach( (element, index) =>{ // elemet = a los elemnto de arr index pues la posicion. | |
console.log( `<li id="${index}"> ${element}</li>`); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment