News for hackers. Stuff that matters.
Re:Understanding JavaScript Objects by rofo1 on Friday July 27, 2018 @10:57AM (#17626400)
Functions are indeed objects in JS, however:

'function' === typeof (function(){}) while 'object' === typeof ({})

There are no classes in JavaScript, the way there are in some OO languages.

The new syntax of 'class' introduced in ES6 is just a synthetic sugar which will be translated to an Object and would use inheritance via the prototype chain.

I suggest the book 'JavaScript: The good parts' (by Douglas Crockford) for more on this topic.

Re:Understanding JavaScript Objects by pvg on Friday July 27, 2018 @01:27PM (#17627589)
just a synthetic sugar

'syntactic[al] sugar' is the term used for this sort of thing and JS classes in particular, just about everywhere.

Re:Understanding JavaScript Objects by SketchySeaBeast on Friday July 27, 2018 @11:02AM (#17626449)
Thanks, I'll take a look! I've been in industry a couple of years now, but my experience with JavaScript has largely been "hit it until it works and then don't touch it again" - there seems to be at least two ways to do anything with no way to tell if one is objectively better.
Re:Understanding JavaScript Objects by goliatone on Friday July 27, 2018 @12:16PM (#17627045)
Well, that’s because due to compatibility we still have the old way of doing things alongside the new ways of doing things plus the multiple future-now way of doing things. JavaScript recently has been moving fast both from a community and committee perspective. However, I think is nowhere near as bad as C++ where you can do similar things is different ways with big nuances on end results.
Re:Understanding JavaScript Objects by riledhel on Friday July 27, 2018 @01:43PM (#17627699)
I highly recommend "Eloquent Javascript" instead because it's easier for beginners or developers coming from another language. It's available online for free too.