Exercises: Encapsulation and 'static' - Object Oriented Programming (OOP) - Javascript In Depth

preview_player
Показать описание
Let's go through some exercises to get more practice with the concept of Encapsulation as well as the "static" keyword in Javascript together.

We start with a warmup to look at how we can create a private method in a class and how we can call that method internally.

The first main exercise explores the "static" keyword and how it works on a class with a static method.

The second exercise has us explaining the prototype chain of a class, it's sub-class, and the normal and static properties and methods. We spend a lot of time making sure we understand the entire chain.

The third main exercise has us looking through the Array Object documentation together to look up static and normal methods and properties and how they might work.

We wrap up the exercises with an open-ended Bonus question where we discuss where we'd use the static keyword and private identifier in our own class and object designs.

Chapters:
00:00 Introduction
00:55 Warmup Exercise - Private Method
06:49 Exercise 1 - Static Method
19:58 Exercise 2 - Explaining Prototypes
45:44 Exercise 3 - Array Class Documentation
55:50 BONUS - When to use static and private?
1:05:12 Next Steps

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

Discovering this channel is like discovering a goldmine

nanlunglongtau
Автор

Absolutely love your explanation and other JS vids. Hopefully you'll consider doing TS vids as well. Sending much love and support

unhingedv
Автор

Finally Thanks a lot Sir.... I'll come back when I start DOM! 💖✨💖✨

ujjwalranjanraoietlucknows
Автор

Thanks for your time, patience and efforts in creating those practical videos. The best in explaining how oop js works. Much appreciated ❤

JackLeiLing
Автор

Hello Bro, Thanks for Making videos and explaining everything in Detail

adil
Автор

I have completed Oops.... N this series is the most underrated video pertaining to JS oops...You can't find content like this anywhere like this on YouTube....

ujjwalranjanraoietlucknows
Автор

Thank you, Nader. this playlist is priceless and definitely needed to be visited again in the future.

for the first question I used the build-in function to solve it: class Utilities {
static camelCase(str) {
return str
.split(" ")
.map((word, index) => {
return index == 0
? word.toLowerCase()
: word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
})
.join("");
}
}

but when it comes to open-ended question here when I get stuck, so I'm working on developing this skill.

MuzdalifahSuliman
Автор

I thought I already had a good understanding of prototypes after learning it from your previous video. That was until exercise 2: I didn't even think Animal.__proto__ was possible initially because when I see a capitalized object, I always associate .prototype to it instead (i.e. Object, Array, etc).

This prompted me to look up the difference between __proto__ and prototype. After reading the top stack overflow post, it all made sense to me: they're Functions, and functions are objects too. Also the prototype property holds the actual object to be assigned to the __proto__ of the instantiated object.

However, please correct me if my understanding is still incorrect .

Thanks again for the great set of exercises Nader, looking forward to the final project!

siancalebdomasig
Автор

came across your channel a couple of days ago and im loving the content. you've helped me solidify my understanding on topics i was struggling with. please keep the videos coming.

djknasfcgjdagsdnfkda
Автор

good course man i like it!

thank you for made it

christobongende
Автор

Very very valuable course Thank you allot man. ❤
It help me allot to educate me and earn and take with me realy hight knowledge about classes at all. 🎉❤

Definitely will watch your RESTfull API course.

tomasmatusek
Автор

Thank you so much for the videos! On a side note, I really like your Vscode theme. May I know which theme it is? It is similar to Dracula but yours look softer in colour which I prefer much more.

Nat-hdit
Автор

Hi Nader, what is your font? I love how is it slightly cursive to some keywords.

ProgramJerol
visit shbcf.ru