Open JoonseokRyu opened 10 years ago
제가 알기로 delete
키워드는 object의 property를 삭제하는 키워드입니다.
var obj = {
a: 123,
b: 'hello'
};
console.log(obj); // { a: 123, b: 'hello' }
delete obj.a;
console.log(obj); // { b: 'hello' }
이슈에 해당하는 코드는 로컬 변수를 삭제하는 건데, 이게 맞는 코드인지 잘 모르겠군요.
strict mode를 사용하지 않아도 로컬 변수가 남아있는 걸 볼 때 이슈의 코드는 맞지 않는 코드라고 생각됩니다.
var text = 'hello';
console.log(text); // hello
delete text;
console.log(text); // hello
"use strict"할 때, 지우는 것을 허용하지 않는다면, delete는 사용하지 않는건가요? 많은 문제가 있어서 그랬을 것같은데 왜 그럴까요?
Deleting a variable, a function, or an argument, is not allowed.