Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts

    missing name after . operator delete keyword

    Code:
    this.delete = function(obj)
    {
    ..
    Is that it ? I can't have delete ? Or can this be written in some other way, including delete ?
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    delete is a reserved word in JavaScript.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Quote Originally Posted by glenngv View Post
    delete is a reserved word in JavaScript.
    Which means, if you want, you can just rename it Delete or DELETE, since JS is case sensitive and won't see those as the same as delete.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    use JSON rules, which allows any key name: you just need to avoid the literal, array works fine:

    Code:
    function C(){
     this['delete']=true;
    }
    
    
    alert(JSON.stringify(new C))
    tested ie9,ff3.6
    Last edited by rnd me; 11-14-2010 at 12:42 AM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,960
    Thanks
    0
    Thanked 236 Times in 233 Posts
    Quote Originally Posted by rnd me View Post
    use JSON rules, which allows any key name: you just need to avoid the literal, array works fine:

    Code:
    function C(){
     this['delete']=true;
    }
    
    
    alert(JSON.stringify(new C))
    tested ie9,ff3.6
    It doesn't work in IE8. Actually delete using dot and square bracket notations works in FF and Chrome and probably some other browsers too but not IE8 and below.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •