Array

var emptyArraySix = new Array(6); var arr = ["moto","auto","casa","perro","gato","oso","lobo"];

For array

for(let i = 0; i < arr.length; i++){ console.log(i,arr[i]); --> //0 'moto' //1 'auto' //... } arr.forEach(function iterar(val,index,arr){ console.log(index,val); --> //0 'moto' //1 'auto' //... }); arr.forEach((val,index,arr) =>{ console.log(index,val); --> //0 'moto' //1 'auto' //... }); for(item of arr){ console.log(item); --> //'moto' //'auto' //... } for(item in arr){ console.log(item); --> //0 //1 //... }
Copyright © 2021 maumartti. All rights reserved. Hand-crafted & made with