Search code examples
javascriptscopeecmascript-5spidermonkey

Defining properties that can't be deleted?


If I do this in JSDB 1.8 which uses Spidermonkey 1.8:

 this.x = 3;
 var y = 4;
 function z() { return 77; }
 this.w = function w() { return 44; }
 this.v = function v() { return 55; }
 w = function w() { return 66; }
 function v() { return 77; }
 delete x;
 delete y;
 delete z;
 delete w;
 delete v;

I get true from the delete x and delete w lines, but false from the delete y and delete z and delete v lines.

What's going on here, and is this behavior defined in the ECMAscript standard or in Spidermonkey? I wanted to remove a function from a particular scope and found that I could not.


Solution

  • read the entire in detail description of delete here http://perfectionkills.com/understanding-delete/