Introduction
JavaScript is a language of the Web. This series of articles will talk about my observations learned during my decade of software development experience with JavaScript. What mistakes a developer generally makes and what differences they should be aware of.
In part 1, we learned about Data Types and touched on Objects. But part 2 will focus in detail on Objects. You can go through Part 1 from here,
Voice of a Developer: JavaScript Data Types.
Ans
Yes, let’s go back in C / C++ days where we have a concept of pointers,
ex
int x=49;
Q: Can you use save as a reference in Javascript like we have in other programming languages?
int *ptr;
ptr = &x;
This means that address of x is stored in ptr.

printf(“%d”, x); // 50
Ex
> var person = {name: "Sumit"};
Similarly, in Javascript the primitive data is saved-as-value. On the contrary, the save-as-reference mechanism is there for objects,
> var anotherPerson = person;
> person.name = "Ravi";
> console.log(anotherPerson.name); // Ravi
> console.log(person.name); // Ravi
The variable is a reference, not a value
The own properties are properties that were defined on the object, while the inherited properties were inherited from the object’s Prototype object.
We learned about own properties in part 1, ex- person.name // own property
Prototypal inheritance – Inherited property
In most OOPS based languages, classes inherit from classes. In Javascript, it’s prototype-based. Objects inherit from Objects. And, we know an object is a prototype of classes. Therefore, it’s the prototypical based inheritance
Ans: Use the property called __proto__
Ex
> var automobile = {engine: true};


Guest UserPosted May 14, 2016, 10:10 AM
Thanks Amit, Rajit, Debasis & others...
Rajib Das GuptaPosted May 14, 2016, 9:53 AM
Nice concept on inheritance.
Amit DavePosted May 3, 2016, 6:56 AM
Nice article!
RakeshPosted Apr 29, 2016, 3:05 PM
Good one sir
Debasis SahaPosted Apr 24, 2016, 1:09 PM
Good one..
Kuppurasu NagarajPosted Apr 24, 2016, 12:38 PM
Nice Sharing..
Rahul Kumar SaxenaPosted Apr 24, 2016, 12:15 PM
Good Show
Vignesh ManiPosted Apr 24, 2016, 9:46 AM
Nice