No video

JavaScript Getters and Setters | Mosh

  Рет қаралды 239,166

Programming with Mosh

Programming with Mosh

Күн бұрын

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:
programmingwith...
/ programmingwithmosh
/ moshhamedani

Пікірлер: 268
@k.safonov
@k.safonov 5 жыл бұрын
I don't understand why everyone can't explain this topic in the same way. Brilliant. Thank you very much!
@erhanertem196
@erhanertem196 2 жыл бұрын
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.
@Retrofire-47
@Retrofire-47 2 жыл бұрын
@@erhanertem196 jeeze, someone has a crush
@JeremyGalloway
@JeremyGalloway 5 жыл бұрын
So much better than the CodeCademy explanation!
@Code325
@Code325 5 жыл бұрын
I just came here from CodeCademy too, and I totally agree!
@ravabat5841
@ravabat5841 5 жыл бұрын
It's true
@samrad6508
@samrad6508 4 жыл бұрын
it's also better than the FreeCodeCamp explanation !
@iamlasbrey6334
@iamlasbrey6334 4 жыл бұрын
lol, also coming from freecodeacademy
@Djolesabijacica
@Djolesabijacica 4 жыл бұрын
yeah
@TheJackTheLion
@TheJackTheLion 2 жыл бұрын
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.
@annasezen5357
@annasezen5357 5 жыл бұрын
you could also use: set fullName(value) { [this.firstName, this.lastName] = value.split(' ') }
@1polyron1
@1polyron1 4 жыл бұрын
Good shit.
@sunspear1813
@sunspear1813 4 жыл бұрын
Although it's a good practice and neat trick, I think it's kind of showoff to write comments like this.
@noahpeltier
@noahpeltier 4 жыл бұрын
@@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!
@darksnow1111
@darksnow1111 4 жыл бұрын
@@noahpeltier YEAH then in this case the whole ES6 is show off, why should we use arrow functions!!!
@3riodokaos333
@3riodokaos333 4 жыл бұрын
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.
@Calupp
@Calupp 3 жыл бұрын
thank you, my current courses' explanation of how this works and its' use case was super clumsy.
@guoxinn
@guoxinn 5 жыл бұрын
Thank you for the awesome explanation, John Smith!!
@dgua2917
@dgua2917 5 жыл бұрын
😂😂😂
@zakhariihusar6975
@zakhariihusar6975 3 жыл бұрын
Glad you started this video with a reason why we need this👍
@julibeeee408
@julibeeee408 5 жыл бұрын
This video answered ALL my questions on getters & setters. Thanks so much!
@ahmadraja5426
@ahmadraja5426 10 ай бұрын
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.
@RyanGordy1
@RyanGordy1 2 жыл бұрын
Mosh should teach every course, no fluff, straight to the point!
@alexlun4464
@alexlun4464 4 жыл бұрын
You're wonderful at explaining topics like these, bravo!
@dianaordonez6747
@dianaordonez6747 3 жыл бұрын
Amazing! I understood this better than others spanish channels. Thank you
@Baltie3
@Baltie3 Жыл бұрын
Very simply explained! Formerly I got lost when other people described the same topic. Thank you very much!
@ronpalmer7260
@ronpalmer7260 8 ай бұрын
Love your Christmas ad. Its epic.
@iaml2909
@iaml2909 4 жыл бұрын
This help me a lot. Thank u very much. I will share this with my telegram group. Thanks again, very helpful.
@armandvermeulen8221
@armandvermeulen8221 Жыл бұрын
This made so much more sense, thank you for the video. Hope you are doing well.
@Chris-ou4ej
@Chris-ou4ej 4 жыл бұрын
Thank you for clear explanation.
@modestas2890
@modestas2890 6 жыл бұрын
very clear explanation. Thank you.
@BHVampireLF
@BHVampireLF Жыл бұрын
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. 😂
@natefr0st239
@natefr0st239 4 жыл бұрын
Simple and clean explanation, lovely!
@ToddsDiscGolf
@ToddsDiscGolf 2 жыл бұрын
This video really helped solidify the ideas after I spent hours on the codecademy “meal maker” project! Appetizers, mains, and desserts, oh my!
@jonjoio9184
@jonjoio9184 2 жыл бұрын
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.
@echelonanglo2226
@echelonanglo2226 2 жыл бұрын
Only explanation i could find out there that made sense to me! amazing, thank you
@krisilyubenov2372
@krisilyubenov2372 10 ай бұрын
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
@dianalisova2669
@dianalisova2669 4 жыл бұрын
Thank you so much for this clear explanation!
@nour.m8205
@nour.m8205 Жыл бұрын
Awesome explanation! I was struggling a bit with this concept. Thanks!
@KleberJS
@KleberJS 5 жыл бұрын
I like so much your explanation about javascript. I always can understand properly
@raphaelugha5348
@raphaelugha5348 4 жыл бұрын
Simple & clean. Loving it! Keep it up!
@anaraberda4677
@anaraberda4677 2 жыл бұрын
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
@kimken8296
@kimken8296 4 жыл бұрын
amazing explanation!! Thanks so much!
@climbers1376
@climbers1376 5 жыл бұрын
Getters and Setters: 2:38-3:04, contextual use case 3:05-3:14, purpose/rule 3:14-5:37, how to prepare
@geovaniraffaelli4508
@geovaniraffaelli4508 5 жыл бұрын
Thanks man, couldn't understand the example from Eloquent JS chapter 6 but this is crystal clear. You're the best.
@hzmi_
@hzmi_ 5 жыл бұрын
I couldn't understand anything from Eloquent JS lmao
@hzmi_
@hzmi_ 5 жыл бұрын
Maybe. I think the examples were a little too complex for me in Eloquent JS. Anyway, your video was helpful! Thank you Mosh.
@geovaniraffaelli4508
@geovaniraffaelli4508 5 жыл бұрын
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.
@hzmi_
@hzmi_ 5 жыл бұрын
Thanks for sharing your insight Nanika. I will give it another try. :)
@147dileep
@147dileep 5 жыл бұрын
@@programmingwithmosh sir, why you always use "const" rather than "var" or "let"...?
@Alex.Shalda
@Alex.Shalda 10 ай бұрын
perfectly explained, thank you!
@mariodmp
@mariodmp 5 жыл бұрын
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.
@LuisMorales-yx8di
@LuisMorales-yx8di 4 жыл бұрын
you always use it in objects, otherwise it wont work
@balakrishnanyukesh1646
@balakrishnanyukesh1646 2 жыл бұрын
You are right mario
@_schemaki_
@_schemaki_ 11 ай бұрын
with in 5 minutes Mosh helped me to understand the topic 😀
@ripplesr5655
@ripplesr5655 3 жыл бұрын
on spot! Thanks a lot for this Mosh!
@xesiusprime9360
@xesiusprime9360 3 жыл бұрын
your explanations are top notch thanks dude
@alisasenicic919
@alisasenicic919 3 жыл бұрын
Great explanation!!! All videos are really great explained! Great teacher skills!
@ZakiZaki-eo7qh
@ZakiZaki-eo7qh 2 жыл бұрын
very informative and straight to the point thank you so much !
@Camel_Coder
@Camel_Coder 2 жыл бұрын
Great explanation, thanks!
@Pareshbpatel
@Pareshbpatel 2 жыл бұрын
An excellent illustration of Getters/Setters in JavaScript. Thanks, Mosh {2021-09-22}
@mohamedtawfik7344
@mohamedtawfik7344 2 жыл бұрын
Great , professional way
@YoBarbados
@YoBarbados Жыл бұрын
Fantastic brother thank you very much!
@misterhtmlcss
@misterhtmlcss 6 жыл бұрын
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.
@mayurapathak1654
@mayurapathak1654 3 жыл бұрын
Thank you ! very clear explanation.
@Wangaruro
@Wangaruro Жыл бұрын
Wow! That's well explained 👏🔥
@homeofstasis
@homeofstasis Жыл бұрын
Insane explanation🌟
@joeya2330
@joeya2330 4 жыл бұрын
English subtitles: Mosh Hamedani ( Marsh comma daddy )
@Karlponken
@Karlponken 3 жыл бұрын
Quick and good explanation, thanks alot!
@p1k1m4ru
@p1k1m4ru 2 жыл бұрын
i really like this explanation - u earn my sub badman!
@kentarotanaka568
@kentarotanaka568 5 жыл бұрын
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.
@mateuszjamroz9994
@mateuszjamroz9994 4 жыл бұрын
Hi nice tutorial, but why can't we do the smae task whitout naming those functions get and set?
@mrmyko
@mrmyko 5 жыл бұрын
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
@pimwiphac.829
@pimwiphac.829 5 жыл бұрын
I was also searching for the explanation right after I watched the videos in Treehouse. Same team! XD
@adriatic123
@adriatic123 4 жыл бұрын
This is a great lecture on getters/setters. Yet I don't understand why can't we use same methods without get/set prefixes. What's the difference, i.e. what is the benefit of using get/set prefixes
@PsychoDude
@PsychoDude Жыл бұрын
he explained it tho on the vid but you vant get a function ad a property without a get u would need to use obj.funcName() and other things in the video
@boozflooz6255
@boozflooz6255 Жыл бұрын
That's awesome, understood it fast because of your explanation. What theme are you using, btw?
@shakeelahmedsiddiqi
@shakeelahmedsiddiqi 6 жыл бұрын
Awesome video for beginners.
@chapman8369
@chapman8369 5 жыл бұрын
thanks for explaining, finally understand setters
@jameshayes3810
@jameshayes3810 2 жыл бұрын
Great explanation. Thank you so much. I have ticked the bell icon :)
@lycan2494
@lycan2494 5 жыл бұрын
i sort of get this explanation... but not 100% about this my mind is a bit torn
@rezvlt9285
@rezvlt9285 3 жыл бұрын
Don't worry not everyone understands it 100% from watching videos. Once you start using these when building stuff you will truly understand.
@ibrahimsinan7994
@ibrahimsinan7994 4 жыл бұрын
Thank you Mosh! AMAZING explanation. Do you have courses on Udemy?
@sakshigosain238
@sakshigosain238 Жыл бұрын
only half way in, but wow what an amazing explanation
@shauncomino5849
@shauncomino5849 6 жыл бұрын
so helpful. very glad i came here
@seekingcode
@seekingcode 5 жыл бұрын
Great explanation! Thank you.
@sonamuhialdeen7866
@sonamuhialdeen7866 3 жыл бұрын
Awesome tutorial
@komybro4208
@komybro4208 2 жыл бұрын
This guy is good at explaining
@Mikef05316338
@Mikef05316338 2 жыл бұрын
Thank you so so much. Just...thanks man!!!
@shubhamsarohi9231
@shubhamsarohi9231 4 жыл бұрын
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?
@HassanMalikTW
@HassanMalikTW 6 жыл бұрын
amazing explanation
@rabeehco
@rabeehco 2 жыл бұрын
Thanks Hamadani!
@Ma1ne2
@Ma1ne2 3 жыл бұрын
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?
@oshadhaedirisinghe1455
@oshadhaedirisinghe1455 2 ай бұрын
Thank you
@russ_the_ceo6456
@russ_the_ceo6456 Жыл бұрын
Thank you!
@luis96xd
@luis96xd 4 жыл бұрын
Whoa, nice video, it was a great explanation 😄
@Mooblr
@Mooblr 5 жыл бұрын
Great video, thanks mosh
@zakariab7187
@zakariab7187 2 ай бұрын
Finally i get it from this video
@evans8245
@evans8245 6 жыл бұрын
bless u, please, never stop what u are doing, im picking this lifeskill and frankly, thanks alot
@yuvrajshukla4616
@yuvrajshukla4616 3 жыл бұрын
nice explanation
@coced
@coced 5 жыл бұрын
You have no idea how long i tried to understand this
@Gwgitu77
@Gwgitu77 6 ай бұрын
Thanks a lot
@oghenefokethompson7407
@oghenefokethompson7407 4 жыл бұрын
hi mosh you have an amazing style in explanation but please i need your data structure course in JavaScript
@sdfadddfasd5990
@sdfadddfasd5990 5 жыл бұрын
Your explanations r so good , please do a JS codecademy walkthrough explanation, their explanations are rubbish
@evgheniiturco9268
@evgheniiturco9268 4 жыл бұрын
this would be soooo cool
@conorm2524
@conorm2524 4 жыл бұрын
Yeah, what is the deal with that? I lose my mind with Codecademy almost every day.
@fredpourlesintimes
@fredpourlesintimes 4 жыл бұрын
Good explanation.
@mohanrajmanneeswaran1076
@mohanrajmanneeswaran1076 4 жыл бұрын
better then codeCademy explanation!
@fefuzii
@fefuzii 2 жыл бұрын
Thanks a lot man
@tonalmeida6023
@tonalmeida6023 3 жыл бұрын
Best teatcher.
@farahmaulida1278
@farahmaulida1278 4 жыл бұрын
MUUUCH MUCH better than codeacademy !thanks man
@andreekzz
@andreekzz 5 жыл бұрын
Excellent. Ty alot
@sidequestuk
@sidequestuk Жыл бұрын
Really god thank you!
@paudelamarianaoancea3761
@paudelamarianaoancea3761 4 жыл бұрын
is this. refereing to the person object ? or to the fullName method ?
@studyaddicts2772
@studyaddicts2772 4 жыл бұрын
Sushant sir😍😍
@anurajms
@anurajms 2 жыл бұрын
thank you
@arielfierro7089
@arielfierro7089 4 жыл бұрын
Why is he using ${person.firstName}, instead of ${this.firstName} on line 6?
@averagebankaiuser5082
@averagebankaiuser5082 4 жыл бұрын
its still inside the scope so it this is not needed to reference the object
@medaminemhamdii635
@medaminemhamdii635 4 жыл бұрын
@@averagebankaiuser5082 not because it's stll in the scope of object , because ${person.firstName) it's refering the window scope and the person object it's already declared there so person.name is accecible from the global scope you don't need 'this' to refer for it
@hodayamirr
@hodayamirr 2 жыл бұрын
tried to find the next lecture's video and couldn't, can i get a link or the name of it? thanks!
@Robinsonov
@Robinsonov 6 жыл бұрын
Hello Mosh thanks for this great tutorial on functions, please can you also make a video on how to use anonymous functions in JavaScript?
@jakubko6748
@jakubko6748 3 жыл бұрын
thanks
@OneBrokeBloke
@OneBrokeBloke 2 жыл бұрын
As someone who isnt far in JS, i dont see why i would bother adding this complexity for that result. I dont mind writing object.method() like this, and i dont know often i would need to change something outside the object
@rubayaat54
@rubayaat54 5 жыл бұрын
Thanks Mosh
@vedchoudhary9519
@vedchoudhary9519 6 жыл бұрын
Thank you sir
@DUO_QUEST
@DUO_QUEST 4 жыл бұрын
Now it's clear to me :)
@matrixInvader
@matrixInvader 2 жыл бұрын
@2:34 you say that a disadvantage with regular methods is that they are 'read-only' and therefore "We cannot set the person's fullName from the outside." How do you mean? person.fullName = "Bob Brown"
@joshel4278
@joshel4278 Жыл бұрын
Please I have a question.... Why does the "this" keyword work when we put them into objects when initializing since objects cannot be accessed before initialisation?Is it because of hoisting,please just explain this to me...
JavaScript Value vs Reference Types
6:48
Programming with Mosh
Рет қаралды 97 М.
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
Cool Tool SHORTS Netherlands
Рет қаралды 9 МЛН
Can This Bubble Save My Life? 😱
00:55
Topper Guild
Рет қаралды 87 МЛН
JavaScript Pro Tips - Code This, NOT That
12:37
Fireship
Рет қаралды 2,5 МЛН
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 235 М.
The Complete Web Development Roadmap [2024]
15:15
Programming with Mosh
Рет қаралды 111 М.
Урок 6. JavaScript. Объекты с Object.create. Что такое getters, setters
14:34
JavaScript Getters and Setters Explained
9:11
Colt Steele
Рет қаралды 20 М.
JavaScript Constructor Functions
6:47
Programming with Mosh
Рет қаралды 246 М.
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
JavaScript GETTERS & SETTERS are awesome!!! 📐
13:14
Bro Code
Рет қаралды 15 М.
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
Cool Tool SHORTS Netherlands
Рет қаралды 9 МЛН