
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Differentiate Object.create vs new in JavaScript Inheritance
In the first example, you are just inheriting amitBaseClass prototype.
function SomeClass() { } SomeClass.prototype = Object.create(amitBaseClass.prototype);
In the second example, you are executing the constructor function. An instance of amitBaseClass is created and you are inheriting the who complete amitBaseClass object.
function SomeClass () { } SomeClass.prototype = new amitBaseClass ();
So, both are doing separate work.
Advertisements