[React & Spring] 3강 - 배열 관련 (concat, filter, map, slice, spread)
배열 관련 - concat, filter, map, slice, 스프레드(전개) 연산자 spread 연산자(얕은 복사) -> 스프레드는 복사할 때 사용 console.log("2.===============추가하기"); const a2=[1,2,3]; const b2 = a2.concat(4); console.log(`a2의 값은: ${a2}`); // 1,2,3 console.log(`b2의 값은: ${b2}`); // 1,2,3,4 push vs concat(불변) a2.push(4); // a2의 값이 1,2,3,4 a2.concat(4); // a2의 값은 그대로 1,2,3 concat은 a2의 값을 변하게 하는게 아님 -> concat은 추가할 때 filter: 걸러내기 a3.filter(): ..
2023. 3. 15.