배열을 다룰 때 유용한 내장 함수들 입니다.
arr.forEach(function(value, index, array))
const week = ['monday', 'tuesday', 'friday', 'thursday'];
week.forEach(day => {
console.log(day);
});
'monday'
'tuesday'
'friday'
'thursday'
const array = [1, 2, 3, 4, 5, 6, 7, 8];
const num = n => n+n;
// 1+1 , 2+2 , 3+3....
const result = array.map(num);
console.log(result);
.
.
[ 2, 4, 6, 8, 10, 12, 14, 16 ]
Array.prototype.filter ( callbackfn [ , thisArg ] )