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,963
    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
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    delete is a reserved word in JavaScript.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,919
    Thanks
    79
    Thanked 4,423 Times in 4,388 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,373
    Thanks
    11
    Thanked 592 Times in 572 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/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 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.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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