It seems in JavaScript you can’t delete function arguments but you
can delete global variables from a function.
Why this behavior?
var y = 1;
(function (x) { return delete y; })(1); // true
(function (x) { return delete x; })(1); // false
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit: Both return
falsein normal use (i.e. not within the Firebug or browser console, which useeval()). See Tim Down’s answer (it should be the accepted one).