forEach, map

박범준·2021년 7월 30일
0

arr.forEach(function(e,i){
console.los(e+""+i);
});

arr.map(function(e,i){
console.los(e+""+i);
});

map 리턴이 존재.

var result = arr.map(function(e,i){
return e + " " + "1";
});
console.log(result);

따라서 map은 리턴을 활용가능.

profile
HTML/CSS/JAVASCRIPT

0개의 댓글