Notes for You:: this Keyword in JavaScript - JavaScript Tutorial 79
is a special keyword present inside every constructor function & methods.
is a reference variable, which always points to the object with which we are currently working.
is used to access members (i.e. attributes & behaviors) of the currently working object.
Actual Code:
function Rectangle(width,height)
{
this.width = width;
this.height = height;
this.getArea=function()
{
return this.width * this.height;
}
}
var rect1 = new Rectangle(5,5);
document.write(rect1.getArea());
document.write("<br/>");
var rect2 = new Rectangle(6,6);
document.write(rect2.getArea());
document.write("<br/>");
Behind the scene code:
function Rectangle(width,height,this)
{
this.width = width;
this.height = height;
this.getArea=function(this)
{
return this.width * this.height;
}
return this;
}
var rect1 = new Rectangle(5,5,#1);
document.write(rect1.getArea(rect1));
document.write("<br/>");
var rect2 = new Rectangle(6,6,#2);
document.write(rect2.getArea(rect2));
document.write("<br/>");
Notes:
replace < with less-than symbol.
replace > with greater-than symbol.
=========================================
Follow the link for next video:
JavaScript Tutorial 80 - Difference between prototype and proto_ in JavaScript
• __proto__ vs prototype in JavaScript ...
Follow the link for previous video:
JavaScript Tutorial 78 - How to create Objects using Constructor function in JavaScript
• How to create Objects using JavaScrip...
=========================================
JavaScript Tutorials Playlist:-
• JavaScript Tutorials
=========================================
Watch My Other Useful Tutorials:-
jQuery Tutorials Playlist:-
• jQuery Tutorials
jQuery UI Tutorials Playlist:-
• jQuery UI Tutorials
Bootstrap Tutorials Playlist:-
• Bootstrap4 Tutorials
=========================================
► Subscribe to our YouTube channel:
/ chidrestechtutorials
► Visit our Website:
https://www.chidrestechtutorials.com
=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial
On this page of the site you can watch the video online this Keyword in JavaScript - JavaScript Tutorial 79 with a duration of hours minute second in good quality, which was uploaded by the user ChidresTechTutorials 21 March 2018, share the link with friends and acquaintances, this video has already been watched 3,753 times on youtube and it was liked by 86 viewers. Enjoy your viewing!