Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-08-2012, 11:20 PM   PM User | #1
pdiddles03
New Coder

 
Join Date: Jun 2010
Posts: 76
Thanks: 0
Thanked 1 Time in 1 Post
pdiddles03 is an unknown quantity at this point
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.
pdiddles03 is offline   Reply With Quote
Old 09-09-2012, 09:21 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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:-

https://developer.mozilla.org/en-US/...g_with_Objects


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.
Philip M is online now   Reply With Quote
Old 09-09-2012, 10:37 AM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,468
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:04 PM.


Advertisement
Log in to turn off these ads.