7 ms·
Understanding JavaScript Objects
- chatmasta 8y agoWhat's with the giant photo of a hipster starter kit at the top of the article?
- octosphere 8y agoProbably a subtle nod to objects, as in, these are the objects you need to be a hipster.
- amelius 8y agoAs someone who hates working on a laptop, it's sad to learn that this will prevent me from being a hipster.
- deleted 8y ago[deleted]
- jerf 8y agoI suggest meta-hipsterism... being too hip to actually, you know, be a hipster. How dull that would be.
- amelius 8y agoThat would probably make me feel misunderstood all the time.
- robbrown451 8y agoHating things that others find convenient and practical actually does the opposite.
- futureproofd 8y agoI think it means that like JS Objects, two hipsters are never equal, even if they have the exact same properties.
- cphoover 8y agoYou win. I'm dying
- deleted 8y ago[deleted]
- SketchySeaBeast 8y agoIs the prototype chain an example of an object as well? An object doesn't need to be instantiated as any sort of class, it can be a function?
- rofo1 8y agoFunctions 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.
- SketchySeaBeast 8y agoThanks, 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.
- goliatone 8y agoWell, 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.
- riledhel 8y agoI highly recommend "Eloquent Javascript" instead because it's easier for beginners or developers coming from another language. It's available online for free too.
- pvg 8y agojust a synthetic sugar 'syntactic[al] sugar' is the term used for this sort of thing and JS classes in particular, just about everywhere.
- elboru 8y agoIt's always nice to find this kind of article where the author synthesizes a lot of knowledge in a single place. I just have an advice, please don't mix upper case and lower case for programming names in your text, it makes it a little harder to understand, as a reader I was not sure if the author was talking about the same object/function or not. For instance I could find "object.assign()" inside a paragraph but then "Object.assign()" in the code example.
- crooked-v 8y agoIt looks like that's just an error. "Object" in uppercase is a special global variable in JS, but there's nothing special about "object" lowercase.
- fireattack 8y agoHe also uses `_proto_` (should be `__proto__`), `(‘b’, ‘c’)` (should be `('b', 'c')`) etc. in the inner text.
- BenRoz 8y agoThanks for the comment, appreciate it! Sorry for the typo, fixed now.