let-const-rest-parameter-spread-operator-destructuring
let
for (var i = 1; i < 11 i++) {
setTimeout(function () {
console.log(i);
}, i * 1000);
}for (let i = 1; i < 11 i++) {
setTimeout(function () {
console.log(i);
}, i * 1000);
}{
let jason = {
codename: 'blackbriar',
kill: function (target) {
target = null;
}
};
let operator = {
codename: 'onion',
answer: function () {
alert('run away!');
}
};
jason.kill(operator);
}
console.log(jason.codename);
console.log(operator.codename);window에 붙지 않는다
TDZ
const
rest parameter
spread operator
destructuring
key말고 다른 변수 명을 쓰고 싶을 때
매개변수에서도 객체 Destructuring
Array Destructuring
매개변수에도 배열 Destructuring
rest parameter + destructuring
Last updated