What are Getters and Setters? - JavaScript Tutorial for Beginners

  Рет қаралды 15,136

dcode

dcode

Күн бұрын

Пікірлер: 41
@TheLuckyyy13
@TheLuckyyy13 2 жыл бұрын
Hey man. I've started learning JS again and i have to say i again find myself ending up on your channel a lot, just like the first time when i was learning. Good content, brotha
@jpanPirate
@jpanPirate 10 ай бұрын
You do a really good job of explaining things.
@elvislopez6903
@elvislopez6903 Жыл бұрын
dawg this is the video that did it for me, thanks bro!
@Tracer73866
@Tracer73866 2 жыл бұрын
5:38 I'm yet to find an explanation to why we use "=" sign here and not write it like "person.primaryInterest("Home Automation")"
@zarina_nz
@zarina_nz Ай бұрын
Great video, thank you!
@ToadyEN
@ToadyEN 2 жыл бұрын
Great video, really well explained! what font do you use btw?
@sajaahmed8006
@sajaahmed8006 Жыл бұрын
Explanation more than wonderful Thank you very much To make information easy
@blackpurple9163
@blackpurple9163 2 жыл бұрын
This improved my incomplete knowledge about getter, setter and the this._name thing
@oriarye9117
@oriarye9117 Жыл бұрын
more helpful then the other creators
@tesstudio
@tesstudio Жыл бұрын
100% clear, Thanks😀
@andrew_ortega89
@andrew_ortega89 2 жыл бұрын
Is there a way to protect the underscore field from external access? I can still manipulate it directly outside the class.
@christian-schubert
@christian-schubert 2 жыл бұрын
Shouldn't be too complicated - just add a hash symbol as a prefix and it becomes inaccessible from outside the class
@dcode-software
@dcode-software 2 жыл бұрын
As others have mentioned you can look at using "private properties" which are a relatively new feature of JavaScript so make sure you check compatibility. Otherwise there are other potential methods such as using closures.
@hatef1725
@hatef1725 Жыл бұрын
Great video man! What extension theme are you using for the color of the text?
@aanders0n
@aanders0n Жыл бұрын
Great video as usual, cheers! what's the theme in this video?
@thedelanyo
@thedelanyo 2 жыл бұрын
Great 👍🏿 explanation
@DarylMalibiran
@DarylMalibiran 2 жыл бұрын
Very good explanation
@dcode-software
@dcode-software 2 жыл бұрын
Thanks! Happy it helped you.
@КравецРостислав
@КравецРостислав 2 жыл бұрын
Great video)👍 But silly me didn't really get the underscore part)
@hassansyed6087
@hassansyed6087 Жыл бұрын
Hey Dcode, How long did it take you to understand JS on a proficient level? Like independently being able to code without reference? Could you share any learning methods? Greet video btw Thanks
@It_guy613
@It_guy613 Жыл бұрын
I have been on this road for two months now i think, and i pretty much can say that i got all the logic behind it, now is just start to implement, and that, my friend, is the real challange! Ahhahahahah
@It_guy613
@It_guy613 Жыл бұрын
The thing i still have questions about is REST, making contact with APIs
@elAmigo805
@elAmigo805 2 жыл бұрын
so underscores are always needed for setters and getters in classes? is it like a reserved character?
@dcode-software
@dcode-software 2 жыл бұрын
No it's not a reserved character, it's simply just convention.
@pawelczar
@pawelczar 2 жыл бұрын
@@dcode-software so does it mean "_name" could be also named as "dog" for setter and gatter?
@poetpenton4392
@poetpenton4392 2 жыл бұрын
could you do an application where we store an object in local storage and get the item. very good. i have been looking for this tutorial
@dcode-software
@dcode-software 2 жыл бұрын
Hey, I've got many videos which use local storage. Do a search on KZbin for "dcode local storage" and you should find a project or two 🙂 good luck!
@ammarhassan_
@ammarhassan_ Жыл бұрын
how does _name work when it is name in constructor?
@N1rOx
@N1rOx Жыл бұрын
Anyone know why his framerate on vscode appears so smooth?
@moneyfr
@moneyfr 2 жыл бұрын
Good video but I need to check video on _variable
@dcode-software
@dcode-software 2 жыл бұрын
It's just a naming convention - it's no hard rule.
@davesharma8946
@davesharma8946 Жыл бұрын
All of this can be done on an object with a object method just as same So what is the point of using getters?
@hrithikvishwakarma001
@hrithikvishwakarma001 2 жыл бұрын
your theme name please
@dcode-software
@dcode-software 2 жыл бұрын
Hey, theme name is "docde". Search it on the marketplace!
@hrithikvishwakarma001
@hrithikvishwakarma001 2 жыл бұрын
@@dcode-software thanxxx 🚀🚀🚀🚀🚀
@sulejmanzekotic183
@sulejmanzekotic183 Жыл бұрын
aren't getters and setters same as defining methods on an object
@babicunlo3638
@babicunlo3638 Жыл бұрын
i still can't see how this is useful in any way. can't you just do your validation/handling inside the constructor and call it a day? what is the advantage here? or am i really dumb? please enlighten me
@Syuzaki1301
@Syuzaki1301 4 ай бұрын
A bit late but for those just finding this video and asking the same question. Getters and setters are really useful when used in conjuction with private fields. E.g. for getters: You keep the initial value protected from mutation/reassignment from the outside using private fields while still allowing to retrieve/access their value by using a getter.
@suelingsusu1339
@suelingsusu1339 2 жыл бұрын
👌👌👌🙏🙏🙏🙏🖖🖖🖖🖖🖖
@dcode-software
@dcode-software 2 жыл бұрын
Glad you liked it 🙂
@Pareshbpatel
@Pareshbpatel Жыл бұрын
Nice tutorial on getters and setters in JavaScript. Thanks, Dom {2023--07-29}
12 Things Every JavaScript Developer Should Know
14:29
dcode
Рет қаралды 11 М.
JavaScript Getters and Setters Explained
9:11
Colt Steele
Рет қаралды 21 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 35 МЛН
Мясо вегана? 🧐 @Whatthefshow
01:01
История одного вокалиста
Рет қаралды 7 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
37:51
bayGUYS
Рет қаралды 660 М.
Reference Vs Value In JavaScript
15:12
Web Dev Simplified
Рет қаралды 185 М.
Getters & Setters | C# | Tutorial 28
12:09
Giraffe Academy
Рет қаралды 196 М.
Map, Filter & Reduce EXPLAINED in JavaScript - It's EASY!
11:23
JavaScript GETTERS & SETTERS are awesome!!! 📐
13:14
Bro Code
Рет қаралды 19 М.
Getter and setter properties in JavaScript
17:18
procademy
Рет қаралды 7 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Learn JavaScript - Full Course for Beginners
3:26:43
freeCodeCamp.org
Рет қаралды 18 МЛН
JavaScript Getters and Setters | Mosh
6:37
Programming with Mosh
Рет қаралды 244 М.
Another 5 Must Know JavaScript Array Methods
14:24
dcode
Рет қаралды 4,4 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 35 МЛН