this Keyword in JavaScript - JavaScript Tutorial 79

Publicado el: 21 marzo 2018
en el canal de: ChidresTechTutorials
3,753
86

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


En esta página del sitio puede ver el video en línea this Keyword in JavaScript - JavaScript Tutorial 79 de Duración hora minuto segunda en buena calidad , que subió el usuario ChidresTechTutorials 21 marzo 2018, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 3,753 veces y le gustó 86 a los espectadores. Disfruta viendo!