JavaScript Getters and Setters | Mosh
HTML-код
- Опубликовано: 14 май 2018
- JavaScript Getters and Setters
🔥Get the COMPLETE course (83% OFF - LIMITED TIME ONLY): bit.ly/2M1sp4B
Subscribe for more videos:
/ @programmingwithmosh
Want to learn more from me? Check out my blog and courses:
programmingwithmosh.com
/ programmingwithmosh
/ moshhamedani
I don't understand why everyone can't explain this topic in the same way. Brilliant. Thank you very much!
His voice is commercial. Everybody buys it first. When voice is welcoming, with the right attitude, pace, bang-on content, psychological impact of close shot of what he is doing (not the entire screen area) and proper-concise-basic explanation would have and certainly had brought him above all the alternate explanations. That's my friend called an educator tapping the maximum.
@@erhanertem196 jeeze, someone has a crush
So much better than the CodeCademy explanation!
I just came here from CodeCademy too, and I totally agree!
It's true
it's also better than the FreeCodeCamp explanation !
lol, also coming from freecodeacademy
yeah
You know why this is great? Because instead of just telling someone what to write and blow their mind you actually explain HOW what you are explaining came to be and WHY you would need it. Not just write this and try to get this. That is the x factor when it comes to coding tutorials. Well done as usual Mosh, I hope that made sense.
you could also use:
set fullName(value) {
[this.firstName, this.lastName] = value.split(' ')
}
Good shit.
Although it's a good practice and neat trick, I think it's kind of showoff to write comments like this.
@@sunspear1813 How else was Anna supposed to share this helpful information? You can't say that commenting alternate methods that seem better is showing off, then teachers would always be showing off, everyone with superior knowledge would be "showing off". In fact, Mosh is showing off by posting these videos! HOW DARE HE!
@@noahpeltier YEAH then in this case the whole ES6 is show off, why should we use arrow functions!!!
SunSpear said that because Anna is a woman. If it was a man's comment, he wouldn't say that. Thanks Anna and sorry for that. Keep commenting and "showing off". You help a lot of people that way.
This video answered ALL my questions on getters & setters. Thanks so much!
You're wonderful at explaining topics like these, bravo!
Thank you for explaining this from first principles.
Starting with a simple object, giving scenarios for why you'd need to implement this, and going from there.
Simple and clean explanation, lovely!
Simple & clean. Loving it! Keep it up!
very clear explanation. Thank you.
Mosh should teach every course, no fluff, straight to the point!
Glad you started this video with a reason why we need this👍
Thank you so much for this clear explanation!
Thank you for the awesome explanation, John Smith!!
😂😂😂
thank you, my current courses' explanation of how this works and its' use case was super clumsy.
Thank you for clear explanation.
Amazing! I understood this better than others spanish channels. Thank you
Only explanation i could find out there that made sense to me! amazing, thank you
I like so much your explanation about javascript. I always can understand properly
Great explanation!!! All videos are really great explained! Great teacher skills!
Love your Christmas ad. Its epic.
amazing explanation!! Thanks so much!
Great explanation! Thank you.
Very simply explained! Formerly I got lost when other people described the same topic. Thank you very much!
This help me a lot.
Thank u very much. I will share this with my telegram group. Thanks again, very helpful.
very informative and straight to the point thank you so much !
perfectly explained, thank you!
Awesome explanation! I was struggling a bit with this concept. Thanks!
This made so much more sense, thank you for the video. Hope you are doing well.
Thank you ! very clear explanation.
on spot! Thanks a lot for this Mosh!
so helpful. very glad i came here
thanks for explaining, finally understand setters
your explanations are top notch thanks dude
Quick and good explanation, thanks alot!
Fantastic brother thank you very much!
Great explanation, thanks!
Great , professional way
Wow! That's well explained 👏🔥
thank you very much for this video. I couldn't understand this topic as I am learning at codeacademy. You managed to explain it in a simple logic way. So happy to come across you video
Awesome video for beginners.
Great video, thanks mosh
An excellent illustration of Getters/Setters in JavaScript. Thanks, Mosh
{2021-09-22}
Insane explanation🌟
This video really helped solidify the ideas after I spent hours on the codecademy “meal maker” project! Appetizers, mains, and desserts, oh my!
Oh thank god not just me. I eventually gave up and followed the video and my code still doesn't work. I've been loving the course so far but this was so weird.
Ohhhh, so that's the difference, I finally understood, thank you very much. 💕 Awesome explanation.
This is the kind of stuff I read before for the question "What's the difference/advantage of a getter over a simple method?", I don't know if it resolves the question because I didn't understood a thing:
-"Given that without a getter, all we can do is poll the attribute for its value, anything else would require a special method which we would have to invoke on the value. Not insurmountable, but will take some thought."
Reading that again made me forget what I saw in the video, I need to rewatch. 😂
Great explanation. Thank you so much. I have ticked the bell icon :)
amazing explanation
i really like this explanation - u earn my sub badman!
Thank you so so much. Just...thanks man!!!
with in 5 minutes Mosh helped me to understand the topic 😀
Awesome tutorial
Excellent. Ty alot
Whoa, nice video, it was a great explanation 😄
Thank you Mosh! AMAZING explanation. Do you have courses on Udemy?
Good explanation.
I can't believe I was able to understand this in 6 minutes compared to 3 hours of lectures. Saved my life for the exam, thanks lol
Thank you!!! This is 1000x better than Treehouse's video on getters and setters. Their instructor they currently have is horrible. Plus it doesn't help when their sample code are using the same variable name that's confusing the heck out me. "get owner(){....} set owner(owner){this._owner = owner; ....}. What the heck is going on! Also thanks for going over pre es2015 code. I would like to know or at least recognized the previous format when I come across it.
Hello Mosh thanks for this great tutorial on functions, please can you also make a video on how to use anonymous functions in JavaScript?
Thank you!
Getters and Setters:
2:38-3:04, contextual use case
3:05-3:14, purpose/rule
3:14-5:37, how to prepare
Thanks a lot man
nice explanation
Thanks Hamadani!
That's awesome, understood it fast because of your explanation. What theme are you using, btw?
bless u, please, never stop what u are doing, im picking this lifeskill and frankly, thanks alot
Thanks a lot
Thank you sir
Hi Mosh,
The getter setter implementation in this video is different from the one in your course of OOP.
Can you please explain which one is better?
Now it's clear to me :)
Thanks man, couldn't understand the example from Eloquent JS chapter 6 but this is crystal clear. You're the best.
I couldn't understand anything from Eloquent JS lmao
Maybe. I think the examples were a little too complex for me in Eloquent JS. Anyway, your video was helpful! Thank you Mosh.
Hey iMpetus. Even though it's a complex book and sometimes you have to reach for other resources in order to fully comprehend things, I still 100% recommend it because once you get through it you'll have a solid understanding of the concepts.
Thanks for sharing your insight Nanika. I will give it another try. :)
@@programmingwithmosh sir, why you always use "const" rather than "var" or "let"...?
English subtitles: Mosh Hamedani ( Marsh comma daddy )
Really god thank you!
hi mosh you have an amazing style in explanation but please i need your data structure course in JavaScript
only half way in, but wow what an amazing explanation
instant Like and Sub. Thank you!
Can you send exercises to pratice this features?
This guy is good at explaining
You have no idea how long i tried to understand this
Thank you
Thanks Mosh
Hi nice tutorial, but why can't we do the smae task whitout naming those functions get and set?
I like this explanation, because on teamtreehouse.com, I was confused and they didn't explain why and when we use getters and setters clearly
I was also searching for the explanation right after I watched the videos in Treehouse. Same team! XD
thank you
How is this related to classes? I know this concept from back in the days when I learned Java to access class attributes. Here I can also do it with objects and that's great, but how is this related to the new ES6 classes in JS?
is this. refereing to the person object ? or to the fullName method ?
better then codeCademy explanation!
Finally i get it from this video
thanks
感謝分享🙏
For learning purposes I used Get to return a value of an outside variable but then I couldn't Set it.
Is there a way to do so ?
if I simply use :
get abcde( ) { return outsidevariable }
set abcde(valuenew) { outsidevariable = valuenew }
and then outside I type:
object.abcde = `whatever`
keeps returning the outsidevariable original value and not the `whatever` I tried to set.
great vid
Very clear on how they work, but I think this one really needed more context e.g. this is a FEW use cases that are common. I felt like I walked away going cool, that's easy to implement, but without any clue on common use cases and I think this one would need that further context. Still a great video, just left me understanding something now that I won't likely use due to my not getting a grasp on when to use it.
thanks for the video, do you also speak farsi ?
Finally a simple and concise explanation about getters and setters, well done Mosh, but any particular reason why you didn't use "this" instead of firstName and lastName on the getter just like you did on the setter?
I tested it and it worked fine for me, it seems that you just didn't do it cause you copied the whole expression from a console.log outside of the object itself.
you always use it in objects, otherwise it wont work
You are right mario
tried to find the next lecture's video and couldn't, can i get a link or the name of it? thanks!
Best teatcher.
thanks!
i sort of get this explanation... but not 100% about this my mind is a bit torn
Don't worry not everyone understands it 100% from watching videos. Once you start using these when building stuff you will truly understand.
MUUUCH MUCH better than codeacademy !thanks man