ES6 Arrow Functions in JavaScript tutorial ( Fat Arrow Function Expression es2015, ecma6)

Поділитися
Вставка
  • Опубліковано 18 лис 2024

КОМЕНТАРІ • 154

  • @kiberkomar
    @kiberkomar 7 років тому +36

    You are born to teach others!!!!.

    • @asmartbajan
      @asmartbajan 6 років тому +1

      Yes, I agree. Some people just have that gift.

  • @user-zb5jp4ti1d
    @user-zb5jp4ti1d 7 років тому +37

    fat arrow functions do not have their own 'this.' really cool. thanks v much.

    • @amicoz
      @amicoz 6 років тому +5

      And that's the most important information about far arrow functions, which lets us decide when to use fat arrow syntax!

  • @benhedgepeth3213
    @benhedgepeth3213 7 років тому +6

    You succeed where many video tutorials fail. Nice job using very basic examples just to illustrate the dynamics.

  • @MrAKGarg007
    @MrAKGarg007 5 років тому +2

    Liked the video, when you explained, when not to use " fat arrow" function. And you don't need to say, "Thank you for watching", when you are delivering such informative content. Thanks for the tutorial

  • @vishvajeetsingh9843
    @vishvajeetsingh9843 4 роки тому +1

    Wow
    You are doing a great work for humanity

  • @anaduhovny3421
    @anaduhovny3421 Рік тому

    Thanks a lot, I really appreciate it. Finding free, high-quality content is very difficult. The sound is good, and the examples are deep. It's a great job you do, thanks a lot!

  • @ruchirai5775
    @ruchirai5775 5 років тому

    You are doing an amazing job.Most of the people doesn't know why to use fat arrow in there code.They just use it more like syntactical sugar.Hope they follow this amazing series and learn the core concepts of javascript.I am awaiting for your series on react + mobx and RXJS observer subscriber.Thank you

  • @djwave28
    @djwave28 5 років тому +2

    This is so cool. Used fat arrow in a forEach to reference "this" without binding.

  • @rammaheshwari3008
    @rammaheshwari3008 5 років тому

    One of the Best Teacher in the Universe

  • @gagangupta1255
    @gagangupta1255 4 роки тому

    One of the easiest video that explained fat arrow this concept.

    • @Techsithtube
      @Techsithtube  4 роки тому

      Thanks Gagan for watching and an awesome comment

  • @Ezzedini
    @Ezzedini 5 років тому +3

    thank you so fucking much, in 5 min i understood what my internship tried to teach me in 4 months.

    • @Techsithtube
      @Techsithtube  5 років тому

      Yacine , glad to have helped. keep on learning! and good luck with your internship.

  • @hemanthaabeywardena3442
    @hemanthaabeywardena3442 7 років тому +2

    Once again, it's to the point and clear. techsith is a role model for tech teachers. Thank you for your effort to plan these, time spent in producing them. I don't get how it attracted three dislikes.

    • @Techsithtube
      @Techsithtube  7 років тому +1

      appreciate the kind comment. That makes me motivated to make more tutorials.

    • @ansarmobile9758
      @ansarmobile9758 6 років тому

      Thanks Sir. May your service continue to the Humanity.

  • @ashutoshsingh5568
    @ashutoshsingh5568 4 роки тому +1

    I knew it you're from NASA. 😅 You teach brilliantly.

  • @aritradasbairagya2439
    @aritradasbairagya2439 6 років тому

    Very clear explanation. I tried few tutorials but you really made it easy to understand. Thanks for the effort.

  • @navidansari1895
    @navidansari1895 6 років тому

    watching this video for the interview purpose.
    Clear cut explaination .
    thanx buddy....

    • @Techsithtube
      @Techsithtube  6 років тому

      Good luck with your interview Navid!

  • @sureshkumaranbu
    @sureshkumaranbu 4 роки тому +1

    Good know underscore works, new information

  • @Okruh_Kolumbiya
    @Okruh_Kolumbiya 6 років тому

    I keep watching different videos on dif topics. And want to say you doing very good job! Thanks

  • @xuelianwang5300
    @xuelianwang5300 6 років тому +2

    Very clear explanation! Thank you for taking effort to make this video!

  • @ill-fatedstranger447
    @ill-fatedstranger447 6 років тому

    Clear explanation with good examples.

  • @SnehasishGhoshSg
    @SnehasishGhoshSg 5 років тому

    Keep doing this. I have continued to back to you when i have some issue with some concept.

  • @abidts2333
    @abidts2333 3 роки тому

    I believe you are being a part of developing react js

  • @JohnnyFive
    @JohnnyFive 8 років тому +1

    Great video. I tried many tutorials, but you made it easy!

  • @Rino37
    @Rino37 4 роки тому

    Not sure if you will see this but here it goes. You suggest that the syntax using the curly brackets with return inside would be more appropriate than simply using implicit return with regards to the one liner. Can you please explain why? Thank you!

  • @amicoz
    @amicoz 6 років тому

    A short tutorial with lot of insight for a beginner like me! Please keep uploading ... :)

  • @steriadi
    @steriadi 5 років тому +1

    You explained very well!

  • @ruchirai5775
    @ruchirai5775 7 років тому +1

    very clear and crisply explained.

    • @Techsithtube
      @Techsithtube  7 років тому

      Thank you Ruchi ! Keep learning !

  • @Mr_BetaMax
    @Mr_BetaMax 7 років тому +1

    Thank you! That helped me understand the fat arrow!

  • @hasanm4973
    @hasanm4973 6 років тому

    Beautifully explained. Thumbs up

  • @rahulchaube2898
    @rahulchaube2898 3 роки тому

    Hello,
    I know you probably know this. But just for people watching this. Arrow functions are function expressions, that means they are not hoisted. Just another difference that came to mind.
    console.log(calcAge(1993));
    let calcAge = birthYear => 2021 - birthYear;// it's a function expression

  • @jbrabec6811
    @jbrabec6811 4 роки тому

    "if using curly braces you should probably use 'return', otherwise it won't work" - LOL, awesome humor!

  • @vaibhavatiitm007
    @vaibhavatiitm007 8 років тому

    Dear, Awesome Explanation. You Always Rocks...!!

    • @Techsithtube
      @Techsithtube  8 років тому

      +Vaibhav Shrivastava Thanks you!

  • @thesunfei
    @thesunfei 8 років тому

    Nice,so easy to use math functions now.

  • @bhanubaghel3012
    @bhanubaghel3012 5 років тому

    now i really understood arrow function deeply i used it lot but i don't have a clue that it can work differently

  • @pricesmith8450
    @pricesmith8450 4 роки тому

    Thank you. Hard to find comprehensive videos on some of these things.

  • @dod9652
    @dod9652 8 років тому

    Amazing tutorials!, You are so good in doing this lectures.
    TNX!

  • @deeproy7292
    @deeproy7292 5 років тому

    thank you...awesome content...I feel according to my knowledge...you did justice to this topic

  • @VinaySingh-nq4ge
    @VinaySingh-nq4ge 5 років тому

    Thanks, sir for great explanation ...nice

  • @martinbozinovski
    @martinbozinovski 5 років тому

    @7:40 you could just delete this.val = 1; and write val = 1;. Or, just invoke x(). Why is that a bad option?
    Btw, i am just starting to learn Js, and your tutorials are the best to learn from. Keep up the amazing job!!!

  • @jeffjgarrett269
    @jeffjgarrett269 7 років тому +2

    Great video, thanks for the insight.

  • @AlexBonillas
    @AlexBonillas 8 років тому

    Very good explanations, keep it up. Cheers!

  • @OhGurov
    @OhGurov 8 років тому +1

    Waiting for the next videos! Really good explanation.
    It would be great, if you will use more complex and usable examples.

  • @elavanresu
    @elavanresu 6 років тому

    Awesome video, you helped me a lot!!! Thanks buddy.

  • @jikiwaify
    @jikiwaify 7 років тому +1

    Great explanation, thank you !

  • @nofavors
    @nofavors 6 років тому

    can you please make a video on how to know that a person is ready for job market or how to self assess programming skills.. probably for javascript related roles like ui dev or fe dev.

    • @Techsithtube
      @Techsithtube  6 років тому +1

      I am defiantly going to make it. I have an idea if you are up for it. I can take your mock interview and we can look at the area where you need to improve and such . what do you think ?

    • @nofavors
      @nofavors 6 років тому

      Thanks for the offer. It is an ambitious proposition. I may not be ready for this at the moment but give me a few months. And I would want to stay anon too. But I would love to see a mock interview in near future with someone who is willing to take the plunge. Thanks again!

  • @theskysthelimit.
    @theskysthelimit. 4 роки тому

    thank you, nice explanation..

  • @georgie_e
    @georgie_e 6 років тому

    Great video ,loved it.
    Just a small doubt correct me if am wrong, isn't it rest operator instead of spread operator that you were using?

  • @ruchirai5775
    @ruchirai5775 7 років тому

    I want to learn react js from begining specially redux part of it. Also recharts and some of the controls. Can you please start a series on redux

    • @Techsithtube
      @Techsithtube  7 років тому

      I have started a series on React . And after few important fundamentals about react. I will go into redux.

  • @MBehtemam
    @MBehtemam 7 років тому

    thanks for amazing video , i have question , is it thin arrow ? const a => "hello"

  • @dimitargetsov9690
    @dimitargetsov9690 6 років тому

    Sir,
    I would like to ask You a question.If i am wrong,just send me "NO".
    This code : "use strict"; function e(){this.r=1;
    setTimeout(console.log(this.r),1000);};var m=new e; - works,
    This : "use strict"; function e(){this.r=1;
    function setTimeout(){(console.log(this.r),1000);}};var m=new e; -doesnt.
    I think the combination of parentheses+ curly braces by default gives THIS as "property" within the curly braces.
    Best regards
    Dimitar

  • @vmjacob123
    @vmjacob123 6 років тому

    Great Video. Thank you so much.

  • @ayyappaaryan3121
    @ayyappaaryan3121 7 років тому

    I have doubt can we use fat arrows in parent function too... for the above given example ..Thanks i am learning great things from you

    • @Techsithtube
      @Techsithtube  7 років тому

      which example are you referring to?

    • @ayyappaaryan3121
      @ayyappaaryan3121 7 років тому

      const X = function(){ //can we replace function key word with fat arrow hear
      this.val =1;
      setTimeout(()=>{ // we have used fat arrow to contine the scope
      this.val++;
      console.log(this.val)
      },1)
      };
      const xx= new x();
      Thanks for your quick reply

    • @ayyappaaryan3121
      @ayyappaaryan3121 7 років тому

      I have one more example
      Const Person = {
      name: "arya"
      cars: ['Ferrari','lambo'] //can we use back ticks hear i have tried but its not working
      toSome:function(){ //can i use fat arrow hear i tried but its not working i don't know yellow
      this.cars.forEach((car)=>{
      console.log(`${this.name} has ${car});
      })
      }
      }
      Person.toSome();

    • @Techsithtube
      @Techsithtube  7 років тому

      That is correct

    • @ayyappaaryan3121
      @ayyappaaryan3121 7 років тому

      can we replace function key word in parent object

  • @bharathmadesh1761
    @bharathmadesh1761 5 років тому +1

    Great Tutorial....:) Thanks :)

  • @sahilarora7186
    @sahilarora7186 4 роки тому +1

    Thank you sir

  • @anthonyhoang1044
    @anthonyhoang1044 6 років тому

    Big fan of all your tutorials. I see you're also from San Jose. Do you teach classes in the area?

    • @Techsithtube
      @Techsithtube  6 років тому +1

      I am working a plan to start a class, it would be in class and online . Let me know if you or any one interested in it. Send me an email . you can find my email on the channel page. Thanks fro watching.

  • @wasifshehzad1987
    @wasifshehzad1987 7 років тому +1

    it was really helpful.

  • @pavansaibitla9008
    @pavansaibitla9008 Рік тому

    Are you using vs code? If not what type of ide it is

  • @ShampooWow
    @ShampooWow 8 років тому

    Awesome video! I like it

  • @udayyadav9230
    @udayyadav9230 6 років тому

    there is no doubt about the content of quality it's awesome. but the most frustrating thing is the advertisement we have to watch and feel helpless when you can't skip the advertisement and I am facing this situation after subscribing this channel.
    Is there anything you can do for this ? Don't keep any advertisement which we can't skip.. Please

    • @Techsithtube
      @Techsithtube  6 років тому

      uday, Google decide which adds are skippable and which are not. I wish I had control over it. I believe when you start watching, the adds are skippable but after watching a few videos, Google knows that you will be watching more videos so they put non-skippable adds.

  • @deepsandy3370
    @deepsandy3370 6 років тому

    Sir which book is best for learning js

  • @jainshilpi3
    @jainshilpi3 6 років тому

    nice video.could you please explain es6 symbol?

    • @Techsithtube
      @Techsithtube  6 років тому

      Symbol is a new data type in JavaScript it allows you to create uniqure values.

  • @moswilam91
    @moswilam91 6 років тому

    why does the `new` keyword actually runs the x() function thats what i don't understand, because when i call x() directly it having the regular functions inside, it logs 2, however like in the video, when i create a new variable xx and assign the x() to it using the new, it logs NaN, why is that and whats the purpose of the (xx) variable anyway

  • @DanielSternCode
    @DanielSternCode 8 років тому

    Very cool format! What program are you using to add your overlays?

  • @mikematsumoto
    @mikematsumoto 8 років тому

    thank you for the videos

  • @RajKumar-kt5pd
    @RajKumar-kt5pd 8 років тому

    awesome man. great

  • @ajotel94
    @ajotel94 7 років тому +1

    thaaaaaaaanks mateeeeee! great video! love it!

  • @shubhambhagat1572
    @shubhambhagat1572 4 роки тому

    I think instead of spread operators you meant to say Rest Parameters at 10.35 ?

  • @jaffareddy6449
    @jaffareddy6449 6 років тому

    If we do iife to the function x , then this.val is available in settimeout function,whereas this.val was not available when you created the object.Is it because of the visibility??

    • @Techsithtube
      @Techsithtube  6 років тому

      its becase every function has its own this. so this inside the settimeout is belongs to that function only.

  • @sushantkshirsagar
    @sushantkshirsagar 6 років тому

    Hey . Thanks for the upload. Do you work in Nimble Storage ?

    • @Techsithtube
      @Techsithtube  6 років тому +1

      yes i do

    • @sushantkshirsagar
      @sushantkshirsagar 6 років тому

      The moment I saw your video I remembered you :) Your videos are really good.

    • @Techsithtube
      @Techsithtube  6 років тому

      you also work at nimble?

    • @sushantkshirsagar
      @sushantkshirsagar 6 років тому

      I use to. Left 2 months back. I had seen you at work couple of times, that how I suddenly remembered. I was in performance automation team.

    • @Techsithtube
      @Techsithtube  6 років тому

      oh i see. I am in the Nexgen UI team . Sok You are learning JavaScript now :)

  • @AshwaniSharma-vg5xm
    @AshwaniSharma-vg5xm 4 роки тому

    brilliant

  • @DKolha
    @DKolha 5 років тому

    Is this fat arrow concept exactly the same as lambdas? or there is important differences?

    • @Techsithtube
      @Techsithtube  5 років тому +1

      Its a wrong comparison, what you want to compare is a function expression that you pass to another function that is a lambda function. that function can be a regular or an arrow function.

    • @DKolha
      @DKolha 5 років тому

      @@Techsithtube very clarifying, thanks... Is that the concept of lamba in python and Java as Well? In my mind I always thought It was directly related on reducing the syntax only...

  • @jainshilpi3
    @jainshilpi3 6 років тому

    sir, I have one question, seeing the performance which is fast javascript or es6?Can we say javascript is fast as it directly runs on the browser whereas es6 need to compile first?

    • @Techsithtube
      @Techsithtube  6 років тому

      es6 is a new version of javaScript so it is JavaScript.

    • @jainshilpi3
      @jainshilpi3 6 років тому

      techsith so we can say javascript is faster. This question is asked in interview

    • @Techsithtube
      @Techsithtube  6 років тому

      you should say ES6 is JavaScript so Its like saying "Am I faster than me" You know what I mean?

    • @jainshilpi3
      @jainshilpi3 6 років тому

      techsith yes sir.. Thanku so much

  • @albjzan
    @albjzan 7 років тому

    Super helpful

  • @binoysubhakumar9955
    @binoysubhakumar9955 6 років тому

    Awesome!.

  • @SapanKumarDas
    @SapanKumarDas 5 років тому

    How to resolve below one please?
    class Abc {
    constructor(name) {
    var that = this
    this.name = name
    }
    printArrowFunction() {
    setTimeout(() => {
    console.log(this.name)
    }, 1000)
    }
    printFunction() {
    setTimeout(function () {
    that.name
    console.log(that.name)
    }, 1000)
    }
    }
    const abc = new Abc('Sapan')
    abc.printArrowFunction()
    abc.printFunction()

  • @saksham.malhotra
    @saksham.malhotra 5 років тому

    Doesn’t this inside setTimeout refer to the global window object? At 7:12 you said that this refers to the function scope itself which is misleading

    • @Techsithtube
      @Techsithtube  5 років тому

      this inside the setTimeout is a closure

  • @javascript_developer
    @javascript_developer 6 років тому

    Cool Thanks.

  • @hiteshkumarmakwana7761
    @hiteshkumarmakwana7761 7 років тому +1

    Thanks brother :)

  • @reemshabir5029
    @reemshabir5029 4 роки тому

    Why in arrow functions var keyword is giving an error?

  • @kartikbisht56
    @kartikbisht56 4 роки тому

    10:03 spread? I guess its rest operator.

  • @someoneoutthere1866
    @someoneoutthere1866 3 роки тому +1

    Thank you for the (...n)!!!

    • @Techsithtube
      @Techsithtube  3 роки тому

      I am gald it helped. Thanks for watching!

  • @billyburton123
    @billyburton123 8 років тому +1

    thanks mate

  • @whome1319
    @whome1319 7 років тому

    thanks

  • @seenuvasanv
    @seenuvasanv 6 років тому

    Thanks,

  • @lexxfirecore123
    @lexxfirecore123 5 років тому

    this.that, no wonder why peope hate JS'ers

  • @yourManLan
    @yourManLan 6 років тому

    thank you! what a g

  • @aswebdev
    @aswebdev 7 років тому

    Hi
    I would like to know why this is incorrect:
    const classes = [
    [ 'Chemistry', '9AM', 'Mr. Darnick' ],
    [ 'Physics', '10:15AM', 'Mrs. Lithun'],
    [ 'Math', '11:30AM', 'Mrs. Vitalis' ]
    ];
    const classesAsObject = classes.map(([subject, time, teacher]) => {subject, time, teacher });
    gives [undefined, undefined, undefined] but i expected
    const classesAsObject = [{ subject: 'Geography', time: '2PM', teacher: 'Mrs. Larsen' }]

    • @Techsithtube
      @Techsithtube  7 років тому

      Since its an object. you need property name. so here is a working example
      const classes = [
      ['Chemistry', '9AM', 'Mr. Darnick'],
      ['Physics', '10:15AM', 'Mrs. Lithun'],
      ['Math', '11:30AM', 'Mrs. Vitalis']
      ];
      const classesAsObject = classes.map((x) => {
      const y = {};
      y.subject = x[0];
      y.time = x[1];
      y.teacher = x[2];
      return y;
      });

  • @ajas105
    @ajas105 8 років тому

    For the setTimeout example, if instead of var xx=new x(); we do x(); this.value is recognized inside setTimeout function written just as above. Can you please explain why that is? Ideally this.value should not have been recognizable in function for setTimeout. To clarify, what I am saying is: jsfiddle.net/sa4nd3by/
    The answer is 2 instead of NaN like it should've been.

    • @Techsithtube
      @Techsithtube  8 років тому +1

      when you use xx = new x() , this is a constructor. so it will create a new object and bind 'this' to that object. if you do x() , this is a normal function first "this" you see is the windows object which is nothing but global object . if you run this you will see what "this" really is if you do x() jsfiddle.net/sa4nd3by/1/

    • @ajas105
      @ajas105 8 років тому

      Thank you for taking the time to explain it. It makes sense now.

  • @omermindivanli2981
    @omermindivanli2981 6 років тому

    thanks :)

  • @qaerdogan
    @qaerdogan 6 років тому

    JavaScript has a lot of trick. I am scared.

  • @ankurvishwakarma8731
    @ankurvishwakarma8731 6 років тому

    Perfect :)

  • @WanderingBackpacker
    @WanderingBackpacker 6 років тому

    can I borrow your brain for tomorrow? I have an interview

  • @avertry9529
    @avertry9529 4 роки тому

    NASA ...lol

  • @RajKumar-kt5pd
    @RajKumar-kt5pd 8 років тому

    hey increase your voice man.please

  • @anakin0405
    @anakin0405 3 роки тому

    I don't find this example as a proper one to explain the fat arrow as there is no need for 'this' in that method. The scope of val has no ambiguity so no 'this' is necessary. Remove all 'this' and the output value is 2.

  • @Abhishekyadav-ur5eu
    @Abhishekyadav-ur5eu 5 років тому

    Why are wearing NASA logo on ur T-shirt

    • @Techsithtube
      @Techsithtube  5 років тому +1

      I used to work for NASA sometime ago. I have collected few tshirts over time

  • @jelovacmaglaj4169
    @jelovacmaglaj4169 5 років тому

    I watch your videos. But this one is very bad explanation, confusing...

  • @ShampooWow
    @ShampooWow 8 років тому

    Awesome video! I like it

  • @denonbasf3117
    @denonbasf3117 2 роки тому

    Thanks :)