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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Structures like 'win95:"blabla",win98:"albalb"'

    I've seen such a javascript constuction already not once, and I can't find any documentation on this feature.
    The exact javascript code is e.g.:

    var _q4W={win95:_XX("zlqgrzv#<83"),win98:_XX(" qvlw {(A@8"),winme:_XX("zlq<{#71<33"),win2000:_XX("{mrhs{w$rx$9244"),winxp:_XX("ykpfqyu\"pv\"7032"),winne t:_XX("xjoepxt!ou!6/31"),winnt:_XX("zlqgrzv#qw3"),linux:_XX("tqv}!8"),macosx:_XX("pdf#rv#{3"),macppc:_XX("rfh%>35")};

    where _XX is a function defined earlier.
    So the question is: is this any sense in such a constructions and (if yes ) how it should be used?
    Should a javascript parser (which I'am developing) support such a syntax or it should generate errors (or maybe just ignore)?
    Thank you for help

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    That is called object literal. Read these links to get more info on this.

    http://javascriptkit.com/javatutors/oopjs.shtml
    http://www.moztips.com/index.php

    Edit:
    jkd beat me to it.


  •  

    Posting Permissions

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