Unpacking #javascript classes
▻https://hackernoon.com/unpacking-javascript-classes-81d32804c978?source=rss----3a8144eabfe3---4
Let’s cut to the chase. So, what do classes mean in JavaScript?To understand classes, we must dig deeper, starting from Object constructorThe Object constructor is the root of all JavaScript objects. You can create any kind of object using the Object constructor. Let me give you the first spoiler of this story here.“It is important to note that, all objects in JavaScript are instances of Object. Think of any object in JavaScript as an instance created by calling Object constructor”// Object(’k1’:’v1’, ’k2’:’v2’)console.log(new Object(’k1’:’v1’, ’k2’:’v2’))// Array[1 ,2, 3]console.log(new Object([1, 2, 3])So, now that we are clear what Object constructor is used for, lets look at the properties of Object constructor.// Print (...)