Тёмный

What are Getters and Setters? - JavaScript Tutorial for Beginners 

dcode
Подписаться 132 тыс.
Просмотров 14 тыс.
50% 1

In today's video we're going to take a look at the power of getters and setters in JavaScript, which can be used on object literals of ES6 classes.
For your reference, check this out:
developer.mozilla.org/en-US/d...
developer.mozilla.org/en-US/d...
🏫 My Udemy Courses - www.udemy.com/user/domenic-co...
🎨 Download my VS Code theme - marketplace.visualstudio.com/...
💜 Join my Discord Server - / discord
🐦 Find me on Twitter - / dcodeyt
💸 Support me on Patreon - / dcode
📰 Follow me on DEV Community - dev.to/dcodeyt
📹 Join this channel to get access to perks - / @dcode-software
If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
#dcode #javascript

Опубликовано:

 

13 июн 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 39   
@TheLuckyyy13
@TheLuckyyy13 Год назад
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
@elidvenega3017
@elidvenega3017 4 месяца назад
You do a really good job of explaining things.
@sajaahmed8006
@sajaahmed8006 Год назад
Explanation more than wonderful Thank you very much To make information easy
@elvislopez6903
@elvislopez6903 10 месяцев назад
dawg this is the video that did it for me, thanks bro!
@tesstudio
@tesstudio Год назад
100% clear, Thanks😀
@thedelanyo
@thedelanyo Год назад
Great 👍🏿 explanation
@ToadyEN
@ToadyEN Год назад
Great video, really well explained! what font do you use btw?
@hatef1725
@hatef1725 Год назад
Great video man! What extension theme are you using for the color of the text?
@DarylMalibiran
@DarylMalibiran 2 года назад
Very good explanation
@dcode-software
@dcode-software 2 года назад
Thanks! Happy it helped you.
@user-ii9rw1ig8z
@user-ii9rw1ig8z 2 года назад
Great video)👍 But silly me didn't really get the underscore part)
@aanders0n
@aanders0n Год назад
Great video as usual, cheers! what's the theme in this video?
@blackpurple9163
@blackpurple9163 Год назад
This improved my incomplete knowledge about getter, setter and the this._name thing
@oriarye9117
@oriarye9117 Год назад
more helpful then the other creators
@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 RU-vid for "dcode local storage" and you should find a project or two 🙂 good luck!
@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.
@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?
@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.
@ammarhassan_
@ammarhassan_ Год назад
how does _name work when it is name in constructor?
@N1rOx
@N1rOx 7 месяцев назад
Anyone know why his framerate on vscode appears so smooth?
@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?
@babicunlo3638
@babicunlo3638 11 месяцев назад
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
@sulejmanzekotic183
@sulejmanzekotic183 11 месяцев назад
aren't getters and setters same as defining methods on an object
@hrithikvishwakarma001
@hrithikvishwakarma001 Год назад
your theme name please
@dcode-software
@dcode-software Год назад
Hey, theme name is "docde". Search it on the marketplace!
@hrithikvishwakarma001
@hrithikvishwakarma001 Год назад
@@dcode-software thanxxx 🚀🚀🚀🚀🚀
@suelingsusu1339
@suelingsusu1339 2 года назад
👌👌👌🙏🙏🙏🙏🖖🖖🖖🖖🖖
@dcode-software
@dcode-software 2 года назад
Glad you liked it 🙂
@Tracer73866
@Tracer73866 Год назад
5:38 I'm yet to find an explanation to why we use "=" sign here and not write it like "person.primaryInterest("Home Automation")"
@Pareshbpatel
@Pareshbpatel 11 месяцев назад
Nice tutorial on getters and setters in JavaScript. Thanks, Dom {2023--07-29}
Далее
One of the most POWERFUL features of JavaScript...
5:53
5 MUST KNOW JavaScript Object Functions
10:42
Просмотров 27 тыс.
JavaScript Getters and Setters Explained
9:11
Просмотров 19 тыс.
JavaScript Promises  -- Tutorial for Beginners
37:05
Просмотров 110 тыс.
7 MUST KNOW JavaScript Tips and Tricks
8:58
Просмотров 20 тыс.
Getter and setter properties in JavaScript
17:18
Просмотров 6 тыс.
The BEST JavaScript DOM Manipulation Methods?
6:49
Просмотров 8 тыс.
ASMR Programming - Spinning Cube - No Talking
20:45
Просмотров 3,7 млн