SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Skyblaze's Avatar
    Join Date
    Jul 2005
    Location
    Italy
    Posts
    734
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    When creating an object are we using an hash?

    When in javascript we do this to create an object and assign it to a variable:

    var myObject = { method1 : function(), method2 : function() ... }

    ...are we usign a normal javascript hash? Has base javascript (without a javascript library as prototype) an hash object?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Yes
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Skyblaze,
    ECMA-262 defines an object as an:
    unordered collection of properties each of which contains a primitive value,object, or function.
    Objects can be considered as associative arrays (hash) since JavaScript is loosely typed (an object can have a variable number of properties).

    I'm not sure I understand the second part of your question, however, internally, JavaScript objects are implemented as associative arrays.

    Thanks,
    YMas


Bookmarks

Posting Permissions

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