Private Variables in JavaScript

preview_player
Показать описание
Many programming languages have the concept of public and private methods and properties. Private methods and properties are ones that cannot be seen or accessed from outside their containing class or file.

While JavaScript does not officially have access modifiers that let you mark something as public or private there is a way that we can create Private variables and methods. That is the topic for this video.

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

Thank you for these amazingly elaborated tutorials, with these weapons, I feel I am no longer afraid of facing real problem alone. Thank you.

rotrose
Автор

Finally! I've found someone, who likes movies and JavaScript in the same time, as I do ^_^. And by the way, thanks for crystal clear explanation of private fields

innai_fox
Автор

helped me greatly while revising my js essentials...never knew i cud make a setter and getter like that. great video!, do keep making more

dineshthangavel
Автор

normally a variable inside of a function is removed from memory after its parent function is executed, how comes this IIFE function keeps a reference to '_prop1' variable, and how does it know that it needs to keep that reference ?

Kapreski
Автор

Very informative and your voice is amazing, thanks for your effort!

rolikaseventysix
Автор

Do private properties and methods in JS classes (#prop, #method) use the same technique behind the scenes? Or they have some other way to hide?

stannikolov
Автор

What if a user tries both the obj.prop1 and obj.prop1(Val)? The setter will change the private value

uchennachukwuba
Автор

great tutorial, it would be great if you can create a video about the same topic as this video but using constructor I mean like class and new keyword those stuff, , you know

romeojoseph