JavaScript-ループ2-
for in, for of
const ary = [1,2,3,4,5];
for in は添え字(index)
for (let i in ary) {
console.log(ary[i]);
}
for of は値(value)
for(let v of ary) {
console.log(ary[v]);
}
人生を素晴らしいものにするために日々もがく私が様々な情報をお届けします。
for in, for of
const ary = [1,2,3,4,5];
for in は添え字(index)
for (let i in ary) {
console.log(ary[i]);
}
for of は値(value)
for(let v of ary) {
console.log(ary[v]);
}