JavaScript Function Constructor - JavaScript Video Tutorial | JavaScript Video for Beginner Tutorial

Published: 21 March 2019
on channel: Learn school online
68
3

JavaScript Function Constructor - JavaScript Video Tutorial | JavaScript Video for Beginner Tutorial

#JavaScriptFunctionConstructor #JavaScriptConstructor #JavaScriptTutorial

JavaScript Function Constructor

Constructors are like regular functions, but we use them with the "new" keyword. There are two types of constructors: native (aka built-in) constructors like Array and Object, which are available automatically in the execution environment at runtime; and custom constructors, which define properties and methods for your own type of object.

A constructor is useful when you want to create multiple similar objects with the same properties and methods. It’s a convention to capitalize the name of constructors to distinguish them from regular functions. Consider the following code:

function Book() { // unfinished code } var myBook = new Book();

this keyword

The value of this, when used in an object, is the object itself.
In a constructor function, this does not have a value. It is a substitute for the new object. The value of this will become the new object when a new object is created.

Object Prototype Chain

All JavaScript objects inherit properties and methods from a prototype. A prototype is an object that is associated with every functions and object by default in JavaScript, where function's prototype property is accessible and modifiable and object's prototype property (aka attribute) is not visible.

JavaScript object has a prototype property, which makes inheritance possible in JavaScript

The prototype property of an object is where we put methods and properties that we want other objects to inherit.

The Constructor’s prototype property is NOT the prototype of Constructor itself, it’s the prototype of ALL instances that are created through it;

When a certain method is called the search start in the object itself, and if it cannot be found, the search moves on to the object’s prototype.

Learn school online is a way to educate online to YouTube viewers. Learn school online provide knowledge, education, and passion for a subject beyond the classroom and share it with audiences worldwide.

Subscribe to our Learn School Online Video YouTube channel to receive notifications when we post new videos.

Browse our PLAYLISTS to find a video series. Click the VIDEOS button on our main channel page to see all our videos.

Youtube Chanel Link:    / learnschoolonline  

for Facebook Video Link
https://www.facebook.com/Learn-School...


Watch video JavaScript Function Constructor - JavaScript Video Tutorial | JavaScript Video for Beginner Tutorial online without registration, duration hours minute second in high quality. This video was added by user Learn school online 21 March 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 68 once and liked it 3 people.