DEV Community

Discussion on: Stop using if else

Collapse
 
andreidascalu profile image
Andrei Dascalu

well ... not really. There's the so-called object notation in JS and the definition of an object as per OOP, which on a higher level is the data represented + methods (any methods, regardless whether you implement encapsulation or not). An "object" { "foo": "bar" }; might be called an object in JS notation, but no in OOP as it lacks methods and a definition (eg: a class of which the object should be an instance of).

Thread Thread
 
rjitsu profile image
Rishav Jadon

Well if you're going that deep, you should know that JavaScript is a prototype based object oriented language, rather than class based, but it still is object oriented, so technically yeah an object is js is an object in OOP

Thread Thread
 
andreidascalu profile image
Andrei Dascalu

As long as you also define methods on the prototype, yes. Object oriented isn't just "call stuff objects". The core of OOP is the communication between objects, regardless of how they are implemented. Encapsulation, inheritance/composition, etc. JS very much an OOP language, but if it's not an instantiated structure according to the definition, it's not an OOP object.

Some comments have been hidden by the post's author - find out more