Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Thanked 5 Times in 5 Posts

    point of objects

    So, I am reading the book, "eloquent Javascript" and it must say it is a very poorly written book. It doesn't explain as to why things work the way they do in javascript and just basically says, "do this" and thats it. But that's beside the point.

    What is the point of objects? all to often, I find tutorials, and other things about beginners guides on how to do things, but many of them (99.9999% of them) don't tell you what it can be used for. I had this trouble with arrays.

    Can someone enlighten me to what the point of objects are? Please don't just tell me, "they ar a type of value where properties can be freely added, removed, or changed". Give me a eveyrday language type of explanation.

  2. #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,699 Times in 2,675 Posts
    In Javascript everything is an object. An object is a collection of properties, and a property is association between a name and a value.

    Have a look at:-


    Frustration - the first time you can't do it the second time.
    Desperation - the second time you can't do it the first time

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  3. #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Thanked 626 Times in 605 Posts
    an object is like a row of a spreadsheet, the header row of a spreadsheet is like a class or constructor.

    if i want a playlist, it would be nice to be able to sort by year, title, artist, etc.
    in js, each playlist item would be an object, and the list itself is an array (if you needed one). arrays are just objects that use 1, 2, and 3 instead of a, b, and c.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com


Posting Permissions

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