JavaScript ES6 Arrow Functions Tutorial

Поделиться
HTML-код

Комментарии • 932

  • @Bigsupreme2000
    @Bigsupreme2000 2 года назад +325

    This guy knows how to explain the basics down from the highly abstracted explanations to a very simple one everyone can understand. Great teacher!

    • @user-gl9tr9nb1u
      @user-gl9tr9nb1u 2 года назад +3

      Absolutely. He's the best

    • @nerkec603
      @nerkec603 Год назад

      Absolutely! I'm not religiosu but whenever he explains to me somethign I've been struggling with am always like "god bless this mf"

    • @BM4Dayz69
      @BM4Dayz69 Год назад +4

      im actually really confused around 7:45 when he starts to explain this this or that this

    • @piggiesgosqueal8066
      @piggiesgosqueal8066 4 месяца назад

      ​@@BM4Dayz69I know I'm replying late but for anyone else confused- I believe he was pointing out that functions and methods are different and when calling a function (even within a method of a class) it will not work to refer to object variables (e.g. this.name) because the function acts as a completely separate block of code than the class and you must either provide the function the variables you're referring to via parameters OR you must be using global variables. Class variables are usable only within a class I think. Whereas if you use => notation then it stays within the class and thus you may use those local class variables.

  • @joefacenda3034
    @joefacenda3034 5 лет назад +724

    I finally understand how arrow functions use the “this” keyword differently. Thank you.

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад +46

      I'm glad I could help!

    • @gunb00t
      @gunb00t 4 года назад +31

      I find still hard to grasp this "this" because of this so much "this" in this guy's speech. Hard to keep track of this. Yet, not this Bob's fault, he does the best to explain this "this".

    • @redwanzia1823
      @redwanzia1823 4 года назад

      haha!!! same here .....8 months JS and REACT .....I finally get it !!! thank you so much!!!

    • @manuelcasares7270
      @manuelcasares7270 4 года назад +2

      @Geno Thank you for explaining this... ba dum ts, very helpful... and confusing...

    • @damansharma6737
      @damansharma6737 3 года назад

      @@WebDevSimplified love u brother..no homo❤️

  • @garster
    @garster 4 года назад +289

    Tip: 99% of the time you can use const over let in JavaScript. Functions can always be assigned to a const since the function code does not change.

    • @dineshvutukuru5692
      @dineshvutukuru5692 3 года назад

      Correct

    • @DenisovichDev
      @DenisovichDev 3 года назад

      Nice

    • @AlThePal78
      @AlThePal78 3 года назад +1

      will using const make the this inside the function inherit the constructors this?

    • @Micro-Moo
      @Micro-Moo 2 года назад

      Perfectly correct. There are more fallacies in this video, I listed them (or some of them) in my other comment.

    • @Micro-Moo
      @Micro-Moo 2 года назад +8

      @@AlThePal78 No way. Const is nothing but const. Moreover, it is a constant declaration only for a variable, not for the properties of an object this variable refers to.

  • @timwright7458
    @timwright7458 3 года назад +21

    Glad I stuck around for the climactic ending where he explains that arrow functions aren't just syntactic sugar but a fix for the scoping issues with regular functions.

    • @techsamurai11
      @techsamurai11 3 месяца назад

      Yeah but that's a language choice - the anonymous function could have had scope... If anything, this creates a mess.

  • @AnnieTaylorChen
    @AnnieTaylorChen 5 лет назад +347

    Notes for Arrow Function:
    1. function keyword NOT needed
    2. let/const variableName = (argument) => {function body}
    3. short hand: curly braces and return keyword NOT needed, return result directly after =>
    4. brackets NOT needed in SINGLE parameter function's argument
    5. do NOT bind "this" (avoid for methods) or "arguments".
    6. It can NOT be used as constructors or generators (I don't know what those mean yet...)
    A good suggestion from developer Lars Schöning:
    1. Use function in the global scope and for Object.prototype properties.
    2. Use class for object constructors.
    3. Use => everywhere else.
    Since I'm a beginner I haven't seen so many examples with errors, so I will probably understand the point 5 and 6 better when I do.

    • @JustSujC
      @JustSujC 4 года назад +8

      Thank you for these notes. Aggregated and concise knowledge like this is invaluable.

    • @Microphunktv-jb3kj
      @Microphunktv-jb3kj 4 года назад

      tech moves so fast...
      es7 = Added exponential operator (**).
      Added Array.prototype.includes.
      es8 = Added string padding.
      Added new Object properties.
      Added Async functions.
      Added Shared Memory.
      es9 = Added rest / spread properties.
      Added Asynchronous iteration.
      Added Promise.finally().
      Additions to RegExp.

    • @ulanb7584
      @ulanb7584 4 года назад +12

      6) let sum = (a,b) => a+b; console.log(sum(2,3)); will output: 5.Here sum is variable but we still can use it as a function when we assign it parameters when running it: sum(2,3); But if you try doing: let sum2 = new sum(3,4); it will give error. cause 'sum' is variable, primitive data structure which hasn't got constructor. The usual function declaration such as: function sum3(a,b){return a+b}; in other case can become a constructor and be used as one. ex: let sum2 = new sum3(5,6); because it has constructor initialized with the same name sum3(). in JS constructors and functions declaration is similar.

    • @MMABeijing
      @MMABeijing 4 года назад +2

      marry me Annie, and thank you

    • @ko-Daegu
      @ko-Daegu 3 года назад

      @@ulanb7584 Thankx what about generators ?

  • @MJRezai
    @MJRezai 4 года назад +89

    I was learning React, then confused about the this keyword;
    I read the MDN Documentation, then w3 schools, stack overflow and everywhere
    but this video was where I was enlightened.
    Thanks Kyle, you're awesome.

    • @diptimalik0101
      @diptimalik0101 3 года назад +1

      same here

    • @Micro-Moo
      @Micro-Moo 2 года назад

      Read Mozilla JavaScript documentation. Yes, Mozilla browser now fails to provide compliance at the level of Chromium, but its documentation is very good.

  • @innocentrage1
    @innocentrage1 3 года назад +1

    I've been doing various tutorials on web design for three months now and didn't fully understand arrow functions till now, thank you so much!!! I will be checking out more videos of yours

  • @andrewkuhlman1665
    @andrewkuhlman1665 Год назад +10

    I appreciate that you have your words together ahead of time and can demonstrate while speaking. I get so frustrated at the content providers that sound like they didn't bother rehearsing and doing multiple takes until the script flows naturally, clearly, and concisely. Thank you!

  • @perseuswong6864
    @perseuswong6864 4 года назад +3

    I'm a big fan of cleaner, concise code syntax.
    This is awesome. Thanks you!

  • @ljli
    @ljli 2 года назад +21

    Kyle, you seriously have a gift for teaching. Everything is so concise and well explained. It's very evident you take a lot of care in planning out your lesson plan. Having been a dev for over 20 yrs and consuming tons of material, you're my go to person when I need to learn or review something. Thanks so much!

    • @TheNagyTheater
      @TheNagyTheater 7 месяцев назад

      Could not agree more! Excellent work. Thank you!

  • @JP-zp6ob
    @JP-zp6ob 3 года назад +1

    anytime im stuck on something i always search for your channel to break it down into something i can digest, thank you!!

  • @griffinsilver5072
    @griffinsilver5072 3 года назад +1

    The portion of the video where you speak about the different usage of this in arrow syntax versus what was standard function syntax was worth its weight in gold. I wrote it in my notes twice. Thank you so much.

  • @kendallhunt981
    @kendallhunt981 4 года назад +5

    Your content is amazing. I am always trying to make my learning more efficient, and I always come to your channel for clear, well taught lessons. They always make sense to me right off of the bat. You're doing great dude!

  • @GretSeat
    @GretSeat Год назад +7

    Dude, I have to admit, this is the first and ONLY video that has helped me understand arrow functions. I've never understood WHY I wrote it the way I did... and you simplified it beautifully. The fact you said "Well, because it's this... you can delete this..." and "And because this... you can get rid of that" was so much easier than people saying stuff like "Okay, just do it like this" Okay, but WHY?
    So thank you, so much for doing this video.

  • @ngunner15
    @ngunner15 3 года назад

    I like how you explain arrow functions in a simple way, always return to this video whenever I want to refresh arrow function and the 'this' binding concepts.

  • @DaalderMees
    @DaalderMees 2 года назад +1

    I absolutely love your videos. You explain everything so calmly and clear. Thanks a lot Kyle!

  • @compton8301
    @compton8301 5 лет назад +68

    This channel is seriously underrated. Thanks Kyle-- you're clear and straight to the point. I subscribed!

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад +4

      I'm really glad I could help!

    • @Micro-Moo
      @Micro-Moo 2 года назад

      This channel is seriously overrated. So much of a failure to get into the essence of things and to promote good practices. People, don't waste time on it, read original documentation and use your own head.

    • @ganavin3423
      @ganavin3423 2 года назад

      @@Micro-Moo hey bro..
      Didn't u attend any classes or any videos regarding web ?...one thing I wish to tell that if someone helps to understand any concept it makes us to Learn quicker.this is smart work...
      I accept your words but we can't follow this in every time...
      If we get some knowledge on any concept .we can easily dig the documentation.

  • @achtube85
    @achtube85 3 года назад +5

    Oh man… the variety of examples, the pace, the clarity… It gives me so much pleasure to finally understand certain concepts in such an easy way. Thanks!

  • @KENAXION88
    @KENAXION88 3 года назад +2

    This is amazing. Your tutorials are the most helpful I've come across. Thank you so much.

  • @AlexHutchingsOfficial
    @AlexHutchingsOfficial Год назад

    I couldn't get this after hours of other people explaining them, and I understand your explanation literally within 2 minutes. Thank you,

  • @dsellis08
    @dsellis08 4 года назад +46

    "This is defined where the function is called" finally made me understand why this.name didn't work in ES5.

  • @jimmydeanbakker
    @jimmydeanbakker 5 лет назад +3

    This is the first time I've seen the arrow functions. I'm going to definitely have to dive nose deep into this.

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад

      They are super nice when trying to write code that utilizes the new ES6 array methods as well as promises. It makes the code so much cleaner.

  • @satvirsandhu207
    @satvirsandhu207 4 года назад +1

    Great explanation, I was having trouble understanding how arrow functions work. I ended up watching around 5-6 videos, and this was the one that finally made it 'click'. Thank you!

    • @chrismaki5456
      @chrismaki5456 2 года назад

      So two years later, where are you at now?

  • @aparna1498
    @aparna1498 3 года назад +1

    I was struggling with this arrow function thing, seriously the comparison use really changed the game for me thanks!!

  • @tym20021
    @tym20021 3 года назад +14

    I love how organised your videos are. No distractions and stuttering like on a lecture. You're making people's lifes so much easier

  • @MatthewWeiler1984
    @MatthewWeiler1984 4 года назад +47

    Great video, you really explain arrow functions well.
    I agree that the "this" scoping is the best reason to use arrow functions.
    I don't agree with making your code more concise as it frankly makes the code harder to understand for novices and lazy developers.
    From what I've seen, working in medium to large companies, most developers are lazy and don't want to learn new things.
    To avoid people constantly asking me how my code works because they don't understand it, I've opted to make my code as readable as possible.
    I add comments wherever there is conditional logic and I always add method/function comments (JavaDoc style).
    I won't make my code as verbose as possible, but I'll avoid one-liners when a couple extra lines containing curly-braces and return statements will help someone else understand the code better.
    In the end, code that is going to be maintained by multiple people, should be written with readability in mind.
    If you're working with code which is negatively affected by nano-second delays introduced by not 100% optimized code, then don't let shitty developers touch that code :p
    But this it about JavaScript, and I've never seen a scenario where JavaScript code is used where such optimization is needed.

    • @pablitocodes
      @pablitocodes 2 года назад +6

      This is a good point. When I was a jr one liners seriously confused the hell out of me.

    • @raven.4815
      @raven.4815 Год назад +1

      Completely agree!

  • @draganpanic1082
    @draganpanic1082 Год назад

    Clear and concise explanation. Have been trying to understand since I started learning JS what the difference was and haven't come across an explanation like this. Finally get it now! Definitely subbed to your channel. Thank you!

  • @lowwastehighmelanin
    @lowwastehighmelanin 2 года назад

    I am in a bootcamp and this topic has been kicking my butt thank you SO MUCH for making this make sense. Wow. This has been stopping me getting my homework done.

  • @TheLinkinax
    @TheLinkinax 5 лет назад +23

    Dude keep it up! you deserve way more subcribers!

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад +5

      Thanks! I only just started RUclips, so I am really happy with where I am so far.

    • @ardonjr
      @ardonjr 4 года назад

      I heard you.. I just subscribed.. this was a joy and informative to watch.

  • @dpapa2175
    @dpapa2175 4 года назад +4

    ah....this finally makes sense to me...(coming from another language and recently learning JS I couldn't understand why my method similar to 2 didn't work. Cheers.

  • @xuevgermanist
    @xuevgermanist 4 года назад +1

    Finally an explanation that I understood and successfully ran! Thank you so much!

  • @hamzahahmad1670
    @hamzahahmad1670 4 года назад

    Your explanation of how arrow functions change the usage of the "this" keyword is the best I've seen on RUclips. Thank you.

    • @WebDevSimplified
      @WebDevSimplified  4 года назад

      You are very welcome. I'm glad my video was able to resonate with you.

  • @Eltopshottah
    @Eltopshottah 4 года назад +170

    Doesn't use semicolon Me: "I too like to live dangerously "

    • @md.shariarkabir7350
      @md.shariarkabir7350 4 года назад +5

      semicolon done by prettier

    • @anonymanonym9004
      @anonymanonym9004 4 года назад +8

      Doesn't use semicolon;
      Me: "I don't like to live dangerously.";
      Looks way cleaner, not?

    • @digitalminister5687
      @digitalminister5687 4 года назад +8

      @@anonymanonym9004 I actually started using semicolons in normal non-programming texts because of the habbit :D

    • @paulopiyo5399
      @paulopiyo5399 4 года назад

      Bruh I actually got ticked off

    • @quinndirks5653
      @quinndirks5653 3 года назад +1

      The rules of JavaScript Automatic Semicolon Insertion:
      flaviocopes.com/javascript-automatic-semicolon-insertion/#the-rules-of-javascript-automatic-semicolon-insertion
      has examples of what can go wrong when you forget to put a semicolon, too.

  • @eddiejaoude
    @eddiejaoude 5 лет назад +10

    Great explanation and examples 👍🤓

  • @tactical_blaireau
    @tactical_blaireau 4 года назад

    Great job Kyle, your explanations are clear and you didn't even punch any holes in drywall!

  • @albertchung7641
    @albertchung7641 4 года назад +1

    Thanks for explaining the scoping for "this"! Now I want to use arrow functions every chance I get!

  • @linhdo1738
    @linhdo1738 4 года назад +3

    He pretty much untangled the "this" myth for me in 9 minutes.... Legend!
    Thank you so much for the video!

  • @jeyzzz696
    @jeyzzz696 4 года назад +14

    just reviewing arrow functions for my tomorrow interview. wish me luck!

    • @WebDevSimplified
      @WebDevSimplified  4 года назад +2

      You got this!

    • @mohammedalmukhtar8949
      @mohammedalmukhtar8949 4 года назад

      How did it go?

    • @jeyzzz696
      @jeyzzz696 4 года назад +2

      @@mohammedalmukhtar8949 the exam was all about JSON manipulation. Really had a hard time I was doing the exam for about 6 hours. Some mobile responsive designs as well was asked. all should be in plain javascript no frameworks.

  • @dudulofuu
    @dudulofuu 4 года назад +1

    Man this was the best video on the subject I've found so far! thanks a million!

  • @jelanmaxwell4762
    @jelanmaxwell4762 3 года назад +1

    Great tutorial! I really enjoyed the explanation of the scope of "this" I'm finally seeing the power of arrow functions. Subed!

  • @damianodamian7907
    @damianodamian7907 3 года назад +4

    Thank you very much for this amazing tutorial. You're really good at explaining stuffs. Great job! I just want to let you know you forgot the parenthesis in "random()" in the third function, otherwise it won't return a number between 0 and 1

    • @lostware6458
      @lostware6458 Год назад

      it would in fact return the Math.random function itself right?

    • @9remi
      @9remi 10 месяцев назад

      @@lostware6458 yeah, it would.
      const randomNumber2 = () => Math.random(); // personally not what i'd do.
      const randomNumber2 = Math.random // way better

  • @mankybrains
    @mankybrains 4 года назад +223

    'This' just confused me.

    • @peefg
      @peefg 4 года назад +4

      LMAO, how sweet comment 😁

    • @ClintDavis86
      @ClintDavis86 4 года назад +35

      Do you mean 'this' the parent scope (youtube video), or, 'this' your own comment 🤣

    • @mankybrains
      @mankybrains 4 года назад +5

      @@ClintDavis86 I'll let the reader of the comment decide. 🤔😊

    • @connectthebits9763
      @connectthebits9763 4 года назад +3

      Completely normal to be confused by it. Think of 'this' as just another property that comes with objects, but it refers to scope.

    • @sommie4935
      @sommie4935 4 года назад

      Instructions unclear, this pointing to afterlife

  • @linjie6446
    @linjie6446 4 года назад +1

    oh man, your videos are so straight forward and easy to understand. Thank you so much

  • @arcadeduo7101
    @arcadeduo7101 2 года назад

    After studying from different sources and this video, I started to get it. Thank you very much. Best teacher!

  • @jean-francoisbouzereau6258
    @jean-francoisbouzereau6258 4 года назад +42

    Another difference is that functions obey to hoisting, when arrow functions do not :
    This works :
    console.log(triple(10));
    function triple(x) { return 3*x }
    This doesn't :
    console.log(triple(10))
    let triple = x=>3*x;

    • @dreamyrhodes
      @dreamyrhodes 4 года назад +2

      huh? Why doesn't the second work?

    • @Chibisenpai2
      @Chibisenpai2 4 года назад +5

      @@dreamyrhodes From what I understand, function declarations get hoisted but function expressions do not. Also "let" does not get hoisted I believe, so it creates an initialization error. If it was "var" you still get an error (a different one) since function expressions do not get hoisted. That's what I think, but please let me know if I forgot something or if I'm wrong.

    • @breasthopper
      @breasthopper 4 года назад +2

      Second one is a function expression right? So even if you don’t use arrow function you still wouldn’t be able to log the second one. Let keyword would give you “triple is not defined” error, while var would give you undefined.

    • @somedude6420
      @somedude6420 4 года назад

      ohhhh

    • @jrgalyen
      @jrgalyen 4 года назад

      But that is a feature of anonymous functions. Hoisting is a strange, irrelevant term. Let fn = function(x) { return x * 3; } // notice the semicolon, required by any good lint rule

  • @nicklandreth2527
    @nicklandreth2527 4 года назад +4

    As someone who learned other languages first it was much harder to envision how regular functions work than how arrow functions work, which would have been what I would have expected from regular functions.

  • @ProtegeBlackMamba
    @ProtegeBlackMamba 5 лет назад +2

    So glad that I found this Channel!

  • @felixsavero4656
    @felixsavero4656 2 года назад

    Thank you so much for the explanation! I've been confused for like hours until your video showed up. Definitely subscribing.

  • @jameswagstaff1962
    @jameswagstaff1962 4 года назад +361

    How many people were screaming 'SEMICOLON' at the screen?!?!

    • @ErrorDebug
      @ErrorDebug 4 года назад +40

      In JS semicolons are not necessary.

    • @jameswagstaff1962
      @jameswagstaff1962 4 года назад +79

      @@ErrorDebug neither are indentations or separating lines of code!

    • @jsprowse
      @jsprowse 4 года назад +36

      I was yelling "PARENTHESES!" at the Math.random line.

    • @ThatResolves
      @ThatResolves 4 года назад +17

      My prettier does it for me lol

    • @topper_clausen
      @topper_clausen 4 года назад +4

      Everyone who teaches code does this -.-
      even proffesional teachers do

  • @Joseph-qb1es
    @Joseph-qb1es 4 года назад +4

    I swear RUclips algorithms can read minds.

  • @menglin7432
    @menglin7432 4 года назад +1

    This explaination is much easier to understand. Thank you so much!

  • @mitor_5052
    @mitor_5052 3 года назад +1

    man ur rly great for make this content for us, i didn't know the context of "this" in js and as an oop dev i have been having problems for long time.. ty a lot

  • @jimosman7301
    @jimosman7301 4 года назад +77

    The fact that he doesn't end every statement with a semi-colon disturbs me.

    • @nagualdesign
      @nagualdesign 4 года назад +4

      Thank you! I thought it was just me.

    • @hugocardoso1488
      @hugocardoso1488 4 года назад +5

      I was thinking the same. It gave me some anxiety ahahah and it's just a tutorial ahahah

    • @evil1717
      @evil1717 4 года назад +3

      Automatic Semicolon Insertion, check it out...

    • @douchymcdouche169
      @douchymcdouche169 4 года назад +6

      @@evil1717 If you're teaching people to code you should teach it with proper syntax. The automatic stuff comes after you've learned how coding works.

    • @houseofdiego
      @houseofdiego 3 года назад

      I know...

  • @MylesGmail
    @MylesGmail 5 лет назад +3

    Thx I tweeted this

  • @lemos51
    @lemos51 4 года назад +1

    3rd video in a row made me subscribe.
    Clear and straight to the point. I'm enjoying your channel so far.
    Keep it up (Y)

  • @RameenFallschirmjager
    @RameenFallschirmjager 4 года назад +1

    Confidence oozes from this dude! And his tutorials are unparalleled!

  • @JoonasKarp
    @JoonasKarp 4 года назад +3

    Could you make your es6 videos with ’react hooks’ specially those where you use ’this’ keyword and ’class’ ? Or simply write it in comments, i really like your videos

  • @shashwatgupta_
    @shashwatgupta_ 4 года назад +3

    can someone tell me when we use the {} braces with arrow function ? do we use it when we have to return multiple line of code ?

    • @BobbyBundlez
      @BobbyBundlez 4 года назад

      yes. no brackets needed is single line that returns something (called implicit return)

  • @machaca111
    @machaca111 2 года назад

    Great explanation, not only did i understand the arrow function as also making it easier to compreend the 'this' keyword

  • @techskeletons7381
    @techskeletons7381 2 года назад

    Great Tutorial...
    also enjoyed your exceptional BLINKING skills!!!

  • @iamb2348
    @iamb2348 4 года назад +10

    "The scoping of the this." Hah

  • @RisyadHasbullah
    @RisyadHasbullah 4 года назад +18

    This this this this this this this. This is so confusing to hear 😂, great video tho!

    • @WebDevSimplified
      @WebDevSimplified  4 года назад +4

      It was just as confusing to say lol. I was so worried I would mess up saying a this at some point.

  • @Koujujutsu
    @Koujujutsu 4 года назад +1

    Duuuuude! This was concise! Thank so much for posting this!

  • @robinkartik6356
    @robinkartik6356 4 года назад

    This is what I am looking for, easy explanation. Wonderful job.

  • @StanbyMode
    @StanbyMode 3 года назад +10

    Challenge:
    Take a shot everytime he says "function"

  • @LonelyJester
    @LonelyJester 4 года назад +3

    so when you use 'this' in the function, since its being called directly from the document. The 'this' would refer to the document? and The document doesn't have a name property so thats why it returns " ", did I understand correctly? 😂

    • @michaelpaxman9731
      @michaelpaxman9731 4 года назад

      This is correct.

    • @nickr753
      @nickr753 3 года назад

      No, this is not correct. Test it for yourself by defining this.name outside of the class definition. The most important point about the issue (which is completely glossed over in the video) is that the this is being referenced in an anonymous function passed as a callback to setTimeout().

  • @yellowrr
    @yellowrr 4 года назад

    You earned a subscribe from this video. Great explanation. As a programmer from a past life who has been getting back into JavaScript for fun, I never understood what the arrow function was used for, until now. Thank you!

  • @erickchavez4551
    @erickchavez4551 3 года назад

    "This" is such a confusing topic, but thanks to your explanation I think I'm getting it now. Thanks a lot!

  • @IcarianX
    @IcarianX 5 лет назад +3

    First part is very good. Could be improved by demonstrating the code in execution though.
    The second part, explaining "this" totally lost me though.

    • @WebDevSimplified
      @WebDevSimplified  5 лет назад +3

      Sorry it was confusing. Essentially all I was trying to say is that the this keyword inside an arrow function is going to be the same as it would be right before the function is defined while the this keyword in a standard function is the same as it would be directly before the place where the function is called.

    • @HemeHaci
      @HemeHaci 4 года назад

      @@WebDevSimplified Nah it wasn't confusing, the way you explained was great. The dude who asked might not be in his best state or simply coding isn't for him. Keep up the good work.

  • @polosatus
    @polosatus 4 года назад +9

    5:22 That code is not exactly the same - first one has no return statement, and though in this example it doesn't matter, you should always make sure that what your function returns is not going to break things in you code. So, just blindly replacing all classic functions with arrow functions might even break things. You might also break things if you rely on function this context (e.g. in event handlers).

    • @codesymphony
      @codesymphony 2 года назад

      true. the last function is specifically used to perform a side effect, but not return a value. airbnb's style guide recommends keeping the curly braces to signify that there's a side effect

  • @SergioArroyoSailing
    @SergioArroyoSailing 4 года назад

    I have just learned about => but only your video discussed scoping, which is by far the most important to use it. Thanks for 'this' . :)

  • @staymotivated1204
    @staymotivated1204 3 года назад

    Thank you so much for your explicit explanation on this. You really made it easier to grasp. subscribed immediately!

  • @zarghamaijaz5933
    @zarghamaijaz5933 3 года назад +3

    i know how 'this' keyword works but when i see it in an actual code, i have no idea what's going on 😟

  • @andrewperez7844
    @andrewperez7844 3 года назад +1

    This video has been so enlightening for this topic! I used to think it was just a syntax thing, but even I as a beginner could see the power of arrow functions! Thanks so much, the 8:00 - 8:30 mark really hit home for me!

  • @tonyjaradev
    @tonyjaradev 4 года назад +1

    You should also add to the description of the video "How to understand "this"" because I've looked for so many videos explaining and finally I get it xD

  • @stephanieowens1390
    @stephanieowens1390 Год назад

    OH my god. Finally -- a good, simple explanation, with simple examples, _without_ a bunch of joking around about it.

  • @johnjoyce
    @johnjoyce 4 года назад

    Nice, well-planned, simple examples to help reinforce.

  • @javieralas05
    @javieralas05 2 года назад

    You're awesome, I've been struggling to understand arrow function and finally got it!

  • @adrianpabloalvarez2523
    @adrianpabloalvarez2523 2 года назад

    Thank you, I was asking myself about arrow functions for a while :).

  • @reignsvicky
    @reignsvicky 2 года назад

    Tons of videos I've seen but your video Really simplified this❤️❤️❤️❤️👍

  • @amandaromero1221
    @amandaromero1221 Год назад

    Subscribed so fast. Thank you for a clear and concise explanation. Emphasis on EXPLANATION. Thanks mate!

  • @praveenbehera1307
    @praveenbehera1307 2 года назад

    I finally understand the concepts of arrow functions. Thank you.!!

  • @dukewellington5222
    @dukewellington5222 3 года назад

    Crystal clear explanation as is the norm on this channel.

  • @benniegamali3622
    @benniegamali3622 2 года назад

    Thanks. The examples and descriptions were realy helpful to understanding the point of using arrow functions.

  • @kimitiwari571
    @kimitiwari571 2 года назад

    You're awesome ,I have been struggling to understand arrow function and now I finally understood . Thanks

  • @josuebarros-desenvolvedorw2490
    @josuebarros-desenvolvedorw2490 3 года назад

    Oh man! I was broking my head to learn that! Thank you very much!!!

  • @IanSebryk
    @IanSebryk 3 года назад

    can't count how many bloody times i've watched other vids trying to explain this concept and walked away in a cloud of WTH. you cleared this up for me in a straightforward way. brilliant. thank you. i learned JS waaaay back and rarely used it until recently. this scoping confusion has haunted the hell out of me until today. you cannot know the relief, because now it jives with the other languages i use regularly.

    • @WebDevSimplified
      @WebDevSimplified  3 года назад

      That is awesome. I am really glad I was able to help.

  • @silviupanait8861
    @silviupanait8861 3 года назад

    Wow, finally someone explained this to me so that I can understand it, thank you so much!

  • @ravitshoval2458
    @ravitshoval2458 3 года назад

    your explanations was the only one that made me really understand the use of it . thanks man

  • @Greg4510able
    @Greg4510able Год назад

    You are the man! I love your way of explaining, it shows that you truly understand what you teach. Thank you so much for your videos, I'm very grateful for them!
    God bless

  • @brauliogarcia1836
    @brauliogarcia1836 2 года назад +1

    fantastic video. not everyone can explain things as he does!

  • @Dragonyoshi013
    @Dragonyoshi013 4 года назад

    Fantastic explanation with great examples. Great work!

  • @thanasisathanasi4965
    @thanasisathanasi4965 2 года назад

    Without arrow functions I would have done nothing. They have saved my life and my projects. !!!!

  • @mriduljayan4466
    @mriduljayan4466 2 года назад

    Your explanations are the best kyle

  • @nikki647
    @nikki647 Год назад

    I finally understand arrow functions! This is great! Thank you so much!

  • @SoyDelSouth
    @SoyDelSouth 2 года назад

    straight to the point with clear concise examples = new subscriber

  • @bicobielich665
    @bicobielich665 2 года назад

    Nice and simple non-convoluted explanation … Thanks

  • @WistrelChianti
    @WistrelChianti Год назад

    Thanks! The latter half of this was spot on what I was looking for!!

  • @battlecrusecruse9155
    @battlecrusecruse9155 3 года назад

    this video is pure gold
    someone give this guy a medal !!!

  • @MrVipulLal
    @MrVipulLal 4 года назад

    Comprehensive tutorial! Thanks for this