<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
a=[10, 11, 12, 13, 14, 15];
console.log('forEach 메소드')
a.forEach(function(value, index){
console.log(value, index, this)
}, [1, 2]);
console.log('map 메소드')
let answer_map=a.map(function(v, i){
if(v%2==0) return v;
}, [1, 2]);
console.log(answer_map);
let answer_map2=a.map(function(v, i){
return v*i;
}, [1, 2]);
console.log(answer_map2);
console.log('filter 메소드');
let answer_filter=a.filter(function(v, i){
if(v%2==0) return v;
}, [1, 2]);
console.log(answer_filter);
console.log('reduce 메소드');
let answer_reduce=a.reduce(function(acc, v){
return acc+v;
}, 0);
console.log(answer_reduce);
</script>
</body>
</html>
9/10