16 JavaScript Module Pattern and Revealing Module Pattern

preview_player
Показать описание
Learn how to introduce variables and functions without leaving an unnecessarily large footprint on the global scope.
Рекомендации по теме
Комментарии
Автор

this lessons went over my head...way more confusing than what you've taught prior. This isn't very beginner friendly.

Jvxo
Автор

Took me a while but i get it eventually. to who didn't get it: "counter" is a object variable that gets its content by a function. Function got variables that can't called global, which means private, and after steps returns object to "counter" variable. They didn't teach those in university so those notes worth as gold.

emreseyit
Автор

Not beginner friendly but definitely good content

Yatin
Автор

This is a good example but it would have been much easier to understand once we understand closures, because of closures, through the methods of the retuned object we are able to access the variables defined inside the function which in this case is count. Also, value is assigned the count variable, and it is also having a closure with the count variable, so the value property does not change as the count changes. However, since the returned object is having a closure with the count variable, so as the count changes, we get the changed value of count even outside the IIFE function (counter).If value variable would have also been defined inside the IIFE then the returned object would have formed a closure with the value as well and it would have behaved like the count variable. Overall, the module pattern is an application of closures in JS. If you understand closures well then it will much easier to follow this example.

yashmundra
Автор

I think the "revealing module pattern" needs a little more here. It looks more like what I would likely use, but I'd like to see it in action (ie. examples) and it would be good to see how it can be broken as well. I am learning JS for a few different reasons, but initially as a way to increase access to RPG MV (game dev software). I'd like the ability to write modules that can play nicely with other modules.

garyjurman
Автор

I just want to thank you for your effort, you helped me a lot till now to understand "js" "Console.log( 'GOD BLESS YOU');"

ahmeddouky
Автор

Youve lost me in this video. I feel like I've missed content somewhere.

crabbasket
Автор

i dont understand this lesson so hard.

alexkira
join shbcf.ru