map배열
각 요소를 변환해 새 배열을 반환합니다.
문법
arr.map(callbackFn)예제
아래 값을 입력하면 예제에 즉시 반영됩니다.
const→numbers→doubled→map→console→const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map((n) => n * 2);
console.log(doubled); // [2, 4, 6, 8, 10]