Awesome video Colt! I've come across getters and setters a few times at work but never really worked with them. It's good to actually see what they do! Thanks!
Good stuff. You didn't mention immutability and encapsulation design principles. If for example you have a class with private fields, you can use getters to expose their values as copies to the public without the program being able to change the private field's value. Some datatypes are immutable, but others aren't like arrays, so this is a great use case of a getter to send a copy of an array (e.g using .slice() ) while protecting the real private array.
@@swagathshetty The getter would return a reference to the original mutable array, unless you purposefully write logic to ensure it's a copy. This is why tricks like returning the array.slice() with no arguments are popular.
Thank you for this man. I was confused for no reason lol I had some weird idea for what getters and setters were and now I understand it's basically using a method as an object's property
The real MVP!! I was getting confuse on creating a setter and getter until I found this video. Thank you once again. I know this is not like c++ but I was wondering if we can also named the method set setFullName(newName) and get getFullName or it is better just a set fullname(newName) and get fullName()
Great video! You are very talented teacher @ColtSteele! Short question: is there a way to make 'first' and 'last' as private properties in JS? Or in TS, maybe?
Great video. Very useful. I'd love to see how you'd tackle a complex form. Something with lots of conditional logic that saves different field values based on those conditions into a database. Also how you'd deal with retrieving the values back into the form to edit and resave them. I can all but hope 👍
I have a question, isn't it a performance issue when a getter is called multiple times instead of only once and returning that value instead of recomputing it every time
Thanks for the video! I would love if you would update your The Modern Javascript Bootcamp Course on Udemy. It really needs a big update like the one you did with the Web Developer Bootcamp at this point, due to all the changes that made a lot of the code to stop working.
If I get you right, the answer is - the constructor of the Person class is accepting 2 values (on the very top - line #2): 'first' and 'last' and then we assign them like - this.first = first. and this.last = last (line #3 and #4). That means when we'll create new object (line #11) - everything we pass into brackets of "new Person()" will assign the first argument as our first name and the second argument - as the second name.
Hey man, at 7:50 your image covers the result of count and it can't be seen, you say it out loud and I think we all understood, just something to consider for your future videos.
Regarding thumbnails, I hate that creators are essentially forced to play the game or be punished by the algorithm. I usually avoid watching if its too egregious in a futile and miniscule attempt to not reward the system.
AMAZING COURSE thank you so much, are you able to create a GO (GOLANG) course? We need it badly, there aren't any good instructors teaching Go properly
Colt Steele: "Always calling it like it is." I'm glad you do because you've helped me learn so much!
Awesome video Colt! I've come across getters and setters a few times at work but never really worked with them. It's good to actually see what they do! Thanks!
Good stuff. You didn't mention immutability and encapsulation design principles. If for example you have a class with private fields, you can use getters to expose their values as copies to the public without the program being able to change the private field's value. Some datatypes are immutable, but others aren't like arrays, so this is a great use case of a getter to send a copy of an array (e.g using .slice() ) while protecting the real private array.
But we can already send a copy of array without using getter right?
@@swagathshetty The getter would return a reference to the original mutable array, unless you purposefully write logic to ensure it's a copy. This is why tricks like returning the array.slice() with no arguments are popular.
Wonderfully said.
I understood bits and pieces of it but i could put it all together eventually
i still watching your web developer classes from the start it really helps me a lot colt!God bless you.
concise, clear, direct and easy to understand. thanks a lot. I was struggling with this before
Thanks for the video, Colt!
Great Video Colt!
Thank you.🙂👍
Really well explained, now I understand them!
Thanks. I'm new to coding and I was trying to figure out what was the point of getters. Cleared it up.
Thanks, I finally understood this thanks to your explanation, well done
Thank you for this man. I was confused for no reason lol
I had some weird idea for what getters and setters were and now I understand it's basically using a method as an object's property
stayed till the end and I gotta say I FINALLY GET IT!!
Thanks for the explanation
Thank you for your explanation!
Love you colt, you dropped this right as I got to OOP in your bootcamp course. Hope you're doing well
Awesome video thank you Colt!
Hey tyler what's UP?
Nice explanation.
The real MVP!! I was getting confuse on creating a setter and getter until I found this video. Thank you once again.
I know this is not like c++ but I was wondering if we can also named the method set setFullName(newName) and get getFullName or it is better just a set fullname(newName) and get fullName()
thanks colt!
thank you!
Great video! You are very talented teacher @ColtSteele!
Short question: is there a way to make 'first' and 'last' as private properties in JS? Or in TS, maybe?
Thanks bud ❤️
Colt you're the best
Thank you
thx♥♥
Great video. Very useful.
I'd love to see how you'd tackle a complex form. Something with lots of conditional logic that saves different field values based on those conditions into a database. Also how you'd deal with retrieving the values back into the form to edit and resave them.
I can all but hope 👍
Shessssshh. Just like that. Thanks
I have a question, isn't it a performance issue when a getter is called multiple times instead of only once and returning that value instead of recomputing it every time
Thanks for the video!
I would love if you would update your The Modern Javascript Bootcamp Course on Udemy. It really needs a big update like the one you did with the Web Developer Bootcamp at this point, due to all the changes that made a lot of the code to stop working.
Still looking to get your JavaScript updated course, Colt
Colt already updated his course on Udemy Web development bootcamp and also the course he made with Stephen grider
@@GoodCodeArabic yeah that's the one I'm looking to get
😘
How did you assign first and last in the constructor when there is no property for that in the class please?
If I get you right, the answer is - the constructor of the Person class is accepting 2 values (on the very top - line #2): 'first' and 'last' and then we assign them like -
this.first = first. and
this.last = last (line #3 and #4).
That means when we'll create new object (line #11) - everything we pass into brackets of "new Person()" will assign the first argument as our first name and the second argument - as the second name.
Hey man, at 7:50 your image covers the result of count and it can't be seen, you say it out loud and I think we all understood, just something to consider for your future videos.
looks like arrow function & couple of variables do the job , better
Timothee chalamander
i watched this to the end in 3-4min bc x2 speed lol
and why should i use this instead of a function
Great video but I still don’t really understand a clear usecase
Regarding thumbnails, I hate that creators are essentially forced to play the game or be punished by the algorithm. I usually avoid watching if its too egregious in a futile and miniscule attempt to not reward the system.
It's pronounced sur-sha
Nice video. But why pick names you don’t know how to spell 😂?
Seems kind of useless thing compared to Java
Pleeeeaaase, quit using any software which has autocomplete drop down list covering the whole screen while we are trying to read the your code.
AMAZING COURSE thank you so much, are you able to create a GO (GOLANG) course? We need it badly, there aren't any good instructors teaching Go properly