JavaScript Objects | Sololearn: Learn to code for FREE!


JavaScript Objects

Is JavaScript Object(datatype) and objects(OOP concept) two different things in JavaScript ? In the below article they are referring to Object(datatype) or objects(OOP concept) ?

9/13/2019 5:39:44 PM


5 Answers

New Answer


I'm not really sure, Objects are quite complicated, in JavaScript there is also a special 'prototype'-chain which I still don't get ... 😅 what the article is trying to say is that Strings, Lists/Arrays, Dictonaries/JSON, functions/methods, constructor-functions, ... are all Objects and that primitive DataTypes have classes too, similar like in Java the primitive datatype 'int' has a object-form from Integer-class. google search stuff I found: Are classes objects in JavaScript? It's important to note that there are no classes in JavaScript. Functions can be used to somewhat simulate classes, but in general JavaScript is a class-less language. Everything is an object. And when it comes to inheritance, objects inherit from objects, not classes from classes as in the "class"-ical languages. Objects in Javascript. ... Loosely speaking, objects in JavaScript may be defined as an unordered collection of related data, of primitive or reference types, in the form of “key: value” pairs. These keys can be variables or functions and are called properties and methods, respectively, in the context of an object.


Anton Böhler I have seen on internet that in JavaScript ES6 and later the concept of classes got introduced.


syntaktical sugar 😅


OOP is just a way of analysing a problem and identifing Objects. for exemple in a game an Object could be a Ball, ... using this you can make it easier to write understandable and structured code which can easily be modified and extended. in the article its self they're talking about that nearly everything in JavaScript is an Object, sth. which stores specific values in a structued way.


Anton Böhler Are you saying that the article is talking about Object data type of JavaScript and not the object(which is instance of a class). Does JavaScript have concepts like classes/objects like in Python ?