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.
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
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
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
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
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.
Great video, thank you!
You do a really good job of explaining things.
dawg this is the video that did it for me, thanks bro!
Is there a way to protect the underscore field from external access? I can still manipulate it directly outside the class.
Shouldn't be too complicated - just add a hash symbol as a prefix and it becomes inaccessible from outside the class
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.
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
more helpful then the other creators
100% clear, Thanks😀
Explanation more than wonderful
Thank you very much
To make information easy
Great video, really well explained!
what font do you use btw?
Great video man! What extension theme are you using for the color of the text?
5:38 I'm yet to find an explanation to why we use "=" sign here and not write it like "person.primaryInterest("Home Automation")"
Great 👍🏿 explanation
Great video as usual, cheers!
what's the theme in this video?
This improved my incomplete knowledge about getter, setter and the this._name thing
Anyone know why his framerate on vscode appears so smooth?
so underscores are always needed for setters and getters in classes? is it like a reserved character?
No it's not a reserved character, it's simply just convention.
@@dcode-software so does it mean "_name" could be also named as "dog" for setter and gatter?
Very good explanation
Thanks! Happy it helped you.
how does _name work when it is name in constructor?
Great video)👍
But silly me didn't really get the underscore part)
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
Hey, I've got many videos which use local storage. Do a search on RUclips for "dcode local storage" and you should find a project or two 🙂 good luck!
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
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
The thing i still have questions about is REST, making contact with APIs
All of this can be done on an object with a object method just as same
So what is the point of using getters?
Good video but I need to check video on _variable
It's just a naming convention - it's no hard rule.
aren't getters and setters same as defining methods on an object
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
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.
your theme name please
Hey, theme name is "docde". Search it on the marketplace!
@@dcode-software thanxxx 🚀🚀🚀🚀🚀
👌👌👌🙏🙏🙏🙏🖖🖖🖖🖖🖖
Glad you liked it 🙂
Nice tutorial on getters and setters in JavaScript. Thanks, Dom
{2023--07-29}