0
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) ? http://radar.oreilly.com/2014/05/what-it-really-means-when-people-say-everything-in-javascript-is-an-object.html
5 Answers
+ 2
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.
+ 2
Anton Böhler I have seen on internet that in JavaScript ES6 and later the concept of classes got introduced.
+ 2
syntaktical sugar đ
+ 1
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.
0
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 ?