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 Coder
    Join Date
    Mar 2013
    Posts
    79
    Thanks
    45
    Thanked 0 Times in 0 Posts

    Why's this simple object not working?

    1: Do do you actually do with objects?
    Aren't they the same thing as functions?

    2: Why's this not working?
    http://jsfiddle.net/h123er2/26r3U/

    Thanks!

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    2. It should be:

    Code:
    var objectName = new Object();
    objectName.length=10;
    objectName.height=30;
    Or:

    Code:
    var objectName = {
        length: 10,
        height: 30
    };

  • Users who have thanked glenngv for this post:

    h123er2 (10-08-2013)

  • #3
    New Coder
    Join Date
    Aug 2013
    Posts
    50
    Thanks
    0
    Thanked 11 Times in 11 Posts
    No, Objects are not the same as Functions.

  • Users who have thanked joesimmons for this post:

    h123er2 (10-08-2013)


  •  

    Posting Permissions

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