화살표 함수는 this를 가지지 않는다.
화살표 함수는 new와 함께 호출할 수 없다.
화살표 함수는 super를 가지지 않는다.
화살표 함수는 arguments를 지원하지 않는다.
const theater = {
store : '건대점',
titles : ['어벤저스', '겨울왕국', '스파이더맨'],
showMovieList() {
// 화살표 함수
this.titles.forEach(title => console.log(`${this.store} : ${title}`));
// 일반 함수
this.titles.forEach(function(title) {
// console.log(this);
console.log(`${this.store} : ${title}`);
});
}
};
theater.showMovieList();
function f(a, ...rest) {} // ⭕
function f(...rest, a) {} // ❌
let arr = [10, 20, 30];
let arrCopy = [...arr];
console.log(arr);
console.log(arrCopy);
console.log(arr === arrCopy);
let obj = { name : '
홍길동
', age : 20 };
let objCopy = { ...obj };
console.log(obj);
console.log(objCopy);
console.log(obj === objCopy);