https://programmers.co.kr/learn/courses/30/lessons/12950
function solution(arr1, arr2) {
let answer = [];
for (let i = 0; i < arr1.length; i++) {
answer[i] = [];
for (let j = 0; j < arr1[i].length; j++) {
answer[i][j] = arr1[i][j] + arr2[i][j];
}
}
return answer;
}
Array.prototype.filter()
filter () 메서드는 주어진 함수의 테스트를 통과하는 모든 요소를 모아 새로운 배열로 반환
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
Array.prototype.map()
map() 메서드는 배열 내의 모든 요소 각각에 대하여 주어진 함수를 호출한 결과를 모아 새로운 배열을 반환
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/map
Array.prototype.reduce()
reduce() 메서드는 배열의 각 요소에 대해 주어진 리듀서 함수를 실행하고, 하나의 결과값을 반환
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
https://medium.com/@hongkevin/js-3-%EC%9E%90%EB%B0%94%EC%8A%A4%ED%81%AC%EB%A6%BD%ED%8A%B8-%EB%B0%B0%EC%97%B4-%EB%A9%94%EC%84%9C%EB%93%9C-reduce-100-%ED%99%9C%EC%9A%A9%EB%B2%95-feat-egghead-io-97c679857ece
Array.prototype.forEach()
주어진 함수를 배열 요소 각각에 대해 실행
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
all
MDN으로 검색하면 Array.prototype.every() 나옴
주어진 모든 요소가 조건을 만족하나 안하나 테스트시 사용. Boolean 반환
any
MDN으로 검색하면 Array.prototype.some() 나옴
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/some
배열안의 어떤 요소라도 주어진 판별 함수를 통과하는지 테스트. Boolean 반환
range
array 생성시 이용
flat()
nested array : 배열 안에 배열이 있는것. 깊이를 레벨로 말함. 레벨1이면 어레이 안에 어레이가 하나 있는거고, 레벨2이면 어레이안에 어레이 안에 어레이가 하나 있는것.
flat() : nested array가 있는 배열의 깊이를 낮춤 ()안에 넣는 숫자에 따라 한단계식 낮춤.아무 숫자도 안넣으면 디폴트1. 완전히 flat한 array를 원하면 Infinity를 넣으면 됨.
현재는 flatten이 아닌 flat으로 사용중
https://dongmin-jang.medium.com/javascript-nested-array%EB%A5%BC-flatten-array%EB%A1%9C-%EB%B0%94%EA%BE%B8%EB%8A%94-%EB%B0%A9%EB%B2%95-42c5cf9b0018
https://developers.google.com/web/updates/2018/03/smooshgate
Higher-Order Function
https://medium.com/@la.place/higher-order-function-%EC%9D%B4%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B0%80-1c61e0bea79
inheritance
https://developer.mozilla.org/ko/docs/Learn/JavaScript/Objects/Basics
여기부터 쭉 읽음