Lecture 11 : Classes & Objects | JavaScript Full Course

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Hope you enjoy learning about object oriented programming using JS ❤
Note - at 13:32 I meant to say object, not class.

shradhaKD
Автор

0:40----Start
16:42---Classes

32:00--Inheritance in JS
40:42----Super Keyword
48:30----Practice set
56:00---Error handling

AmanKumar-ojks
Автор

#1:00:42
Here, I have to add an important point.

Example #1
const person = {
name: "John",
country: "USA",
city: 'New York',
dispaly: () => {
console.log(`This is ${this.name} from ${this.city}, ${this.country}`)
},
}

person.display()
output:
This is from undefined, undefined

Example #2
const person2 = {
name: "John",
country: "USA",
city: 'New York',
dispaly() {
console.log(`This is ${this.name} from ${this.city}, ${this.country}`)
},
}

person2.display()
output:
This is John from New York, USA


In JavaScript, regular functions (like display() in the second example) have their own this binding that depends on how they are called. When we call person.display(), this inside the function refers to the person object.

However, arrow functions behave differently. They don't have their own this binding, instead, they inherit it from the surrounding context where they are defined. In the first example, the arrow function is defined within the object literal. At that point, this refers to the global object (usually window in browsers). And here this.name will return an empty string because it is the windows' property which gets/sets the name of the window's browsing context. That is why the output of first example is "This is from undefined, undefined", instead of "This is undefined from undefined, undefined".

So, don't use an arrow function as a method of an object. Instead, use a regular function.
Thanks

muhammadzulqarnain
Автор

Please REACT.JS ka aisa hi course bana do 🙏🏼 you’ve helped me alot. Jaisa aap samjhaate ho, Vaisa YouTube pe aur koi nhi karr paa rha. Huge respect.

Ishaan_malik
Автор

🫵Like and comments for REACT.JS Course form Shradha didi. Students are very excited ❤❤❤

Hardik_Kamaliya
Автор

After JavaScript please start ReactJs.

akashpassi
Автор

React js ka course bana dein please aap bht acha samjhati hain

ahmedsuriya
Автор

This is best video on classes and inheritance on youtube. I have watched many videos. But none of them explain with such clarity. Thank u shradha mam

namitadas
Автор

After javascript please start React js❤🎉

tusharmore
Автор

Topic covered in this video
Class
Object
Methods
Constructor
Inheritance
Method overriding
Error handling
Super

Future_software_enginneer
Автор

00:01 Understanding classes, objects, and inheritance in JavaScript.
02:07 Creating and working with objects in JavaScript
06:07 Understanding prototype and object creation in JavaScript
08:34 Understanding prototypes and inheritance in JavaScript
12:43 Classes and objects allow for creating reusable functions and properties for multiple instances.
14:39 Understanding classes, objects, and prototypes in JavaScript
18:52 Understanding class, methods, and properties in JavaScript
23:00 Understanding class properties and creating objects
26:48 Custom constructors can be created in JavaScript to perform specific tasks.
30:04 Understanding the role of constructor in object creation
34:42 Classes create a blueprint to define and reuse objects, reducing code repetition.
36:27 Understanding classes and objects in JavaScript
40:51 Using super keyword to call parent class constructor
42:46 Calling super constructor is essential in JavaScript inheritance
47:04 Super keyword is important for inheritance and method invocation in JavaScript
48:57 Creating a User Class in JavaScript
53:08 Creating a new class and implementing inheritance in JavaScript.
55:22 Classes and objects in JavaScript with error handling
59:08 Understanding classes, objects, inheritance, and error handling in JavaScript

shresthshukla
Автор

maam you are the best teacher found on youtube to make students understand easily by answering some easy practice questions, where students can understand the real use of the concept you taught in the class

arjunprajapatt
Автор

you are among the best teachers on youtube.the way in which you explain concepts is really amazing.

K.K
Автор

Her way of teaching is very simple and clear.If anyone just starting to code or complete beginner just follow her. Excellent teacher💯❤

MohsinAli-ifzg
Автор

React Js par Full Course kon kon chahtha hai ?

Paradoxgaming
Автор

I understood the actual concept of error handling properly for the first time. Thank you so much ma'am.

ishikaagrawal
Автор

Because of this chapter I was stuck in JS, the Udemy instructor could not explain the way you have explained. Thank you so much for explaining OOP in easiest way : )

PankajPL
Автор

Miss your content is really one of best even better than many course content on Java script, May you flourish and be more versatile and successful.

awaisahmad
Автор

Didi lecture 4 tak bohot easy tha Lecture 5 se thoda tough laga but apka explanation itna acha ha ap bina samjhaye koye bhe part chodte nhe ho...

Thanks for your valuable efforts for us...

sambangalore
Автор

Yes didi, we enjoy while learning via ur lectures. Thank you so much for your efforts. It means a lot to us ✨😇.

learnwithnagma