this Keyword in JS | this in Regular functions vs Arrow Functions |JavaScript Interview Series: EP-4

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

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

  • @CodeWellTech
    @CodeWellTech  2 года назад +10

    Hey Guys, if this video is helpful to you , then please Hit the LIKE and SUBSCRIBE button that means a lot 🙏

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

    so many channels with million of subscribers could not justify this explanation!, Thank you so much

  • @pragathiprabhu5750
    @pragathiprabhu5750 2 месяца назад +1

    Clear explanation ..Thanks

  • @sivasundarpt
    @sivasundarpt Год назад +1

    Clear Explanation about the flow of this keywords in Normal and Arrow function .... Thanks for the clarification.

  • @amith2607
    @amith2607 Год назад +2

    Nice explanation!...gone through many videos for this keyword, but your video was the only which clearly taught about THIS keyword in javascript.

  • @mearn_ctaftsman
    @mearn_ctaftsman Год назад +3

    Crystal clear, I was so confusing before this video about this keyword.
    Now I am so confident 🙏🙏🙏🙏🙏

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

    wow how you demonstrate is amazing

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

    best video on "this" topic ,thanks

  • @saikumargatla4706
    @saikumargatla4706 11 месяцев назад +1

    This video and this channel is a hidden gem

  • @amitozralhan3848
    @amitozralhan3848 Год назад +1

    One of the best explanations of this concept ! Thank you !

  • @abcdabcd8605
    @abcdabcd8605 6 месяцев назад +1

    Excellent and Clear explanation!!

  • @jenso413
    @jenso413 2 года назад +5

    ah this is the best video i’ve seen on this topic, really cleared some things up for me. thank you!

  • @kavis8904
    @kavis8904 7 месяцев назад +1

    Nicely explained thanks

  • @gokulkadnar706
    @gokulkadnar706 Год назад +1

    Thanks......seen multiple videos to clear that key difference....finally cleared for lifetime.

  • @vinayjangra1401
    @vinayjangra1401 Год назад +3

    Thanku so so so so so much 😍😍😍😍😍😍

  • @Jtube0101Mega
    @Jtube0101Mega 6 месяцев назад

    Great lesson! Thank you very much!

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

    why your channel is so underrated? loved your way of teaching thanks for “this” tutorial😜

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

    best explanation of this keyword so far.. thanks a lot

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

      Thanks a lot kindly share with others

  • @yanlinma1494
    @yanlinma1494 Год назад +1

    Very good explanation

    • @CodeWellTech
      @CodeWellTech  Год назад +1

      Tq ... will be appreciated if you share with others 😎

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

    very good explanation, thanks

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

    Perfect explanation

  • @soumadip_banerjee
    @soumadip_banerjee Год назад +2

    loved the explanation. Lot's of love from Kolkata!

  • @orik737
    @orik737 2 года назад +5

    Deserves so many more views, super good explanation of an unintuitive topic

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

      Glad you liked it. Kindly share it.

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

    great & easy

  • @brandonlee378
    @brandonlee378 Год назад +1

    Thanks for breaking this down so clearly!

  • @msraza1253
    @msraza1253 Год назад +1

    Great explanation 👍🏼👍🏼👍🏼, deserve more views nad likes 👍🏼👍🏼

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

    Awesome!!!!!

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

    best explnation till date...about scope of this in arrow and normal function...Thanks a lot!

  • @hackieesri8923
    @hackieesri8923 9 месяцев назад +1

    Subscribed Man !!!!

  • @VishalSharma-rn7mt
    @VishalSharma-rn7mt Год назад +1

    Awesome, simple and clear explanation.

  • @fervabatool934
    @fervabatool934 Год назад +1

    Extremly eye opening concept of THIS .... well taught .... why your channel is underratted ?
    LOVE THE CONCEPT YOU TAUGHT ... NO BODY ELSE DO THAT NOT EVEN JONAS the udemy instructor

  • @pawanchoudhari5130
    @pawanchoudhari5130 Год назад +1

    Thank you so much for explaining this way

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

    Most straightforward explanation ever, Thank you!!🙏

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

    Very well explained. It was so easy to understand all the points. Thank you 🙏.

  • @arunkumarpandi4044
    @arunkumarpandi4044 Год назад +1

    Just a suggestion you can also explain the call apply bind with the same example . Where before changing it to arrow function of greet2 (with the same normal function greet 2 we can apply call,apply and bind to get the same output like "greet2.apply(this);" (or) greet2.call(this); (or) greet2.bind(this)(); ) which also covers the call, apply and bind methods

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

    Worth to watch your video

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

    Good video.. the way you explain is very nice.. this video deserves more likes and views

  • @raulnardone7062
    @raulnardone7062 2 года назад +2

    Many, many thanks Sir!

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

    Great job bro!

  • @yue7507
    @yue7507 Год назад +1

    thank you! easy to understand

  • @judgebot7353
    @judgebot7353 11 месяцев назад +1

    damn you earned a subscriber here . Thanks❤

  • @mohinischannel9665
    @mohinischannel9665 8 месяцев назад

    VERY VERY NICE EXPLAINATION

  • @hemanth8336
    @hemanth8336 Год назад +1

    Thank you brother

  • @JyotiSharma-wb1vy
    @JyotiSharma-wb1vy 2 года назад +1

    Your amazing explanation made it so easy to understand the whole topic. Thanks a lot!

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

      Really thanks for feedback. Sharing of this video will appreciated 😊

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

    Thanks bro.....

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

    Amazing 😊😊

  • @Saksham-Gupta
    @Saksham-Gupta Год назад +1

    Sir, Greet1 function is also defined in the person object scope, but if we use arrow function on greet1 then , this refers to window object instead it should point to person object

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

      Will check and answer soon. Bit busy now a days. Please don't paste other channels urls or links. Hope you understand. Instead you can provide your understanding.

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

      Sorry for late reply, as I mentioned in the video arrow function will not have own this. You can explicitly pass the scope using bind. Will try to cover everything about arrow functions and scope in next video. Thanks for understanding and interest.

    • @hellonehha
      @hellonehha Год назад +1

      The reason is object doesn't have any 'this'. In FAF, greet1 is referring to the window. Whereas in the greet2 (FAF) this is getting inherited from the parent and in this case it is a normal function and normal function has this. Hence, greet2 (FAF) is able to return the output.

  • @vishnuerema415
    @vishnuerema415 Месяц назад

    ❤❤

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

    Thank you sir

  • @IvanBankovic-k6n
    @IvanBankovic-k6n Год назад

    Great video and thanks but what is going on when you use setInterval, why it always set it back to window object? How setInterval calls its function?

  • @vinayjangra1401
    @vinayjangra1401 Год назад +1

    Thank you so much, you made it so easy to understand 🔥🔥 💯

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

    please do more videos on the front end .very good content

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

      Thanks Anand. Kindly like and follow my videos. Will do more videos on frontend.

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

    Thanks sir love you from Pakistan ❣️❣️

  • @jazimabbas8168
    @jazimabbas8168 Год назад +1

    Could you please explain. You said in arrow function it matters where function is defined. And greet2 is defined in the person object. This is the explanation you gave. Lets convert greet1 function to arrow function. Then the greet1 arrow function will also defined in the person object right. Then this will not reference the person object. But it still defined in the person object.
    Need some explanation please.. Thanks in advance ...

    • @Saksham-Gupta
      @Saksham-Gupta Год назад

      i have the same ques

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

      Sorry for late reply, as I mentioned in the video arrow function will not have own this. You can explicitly pass the scope using bind. Will try to cover everything about arrow functions and scope in next video. Thanks for understanding and interest.

  • @relaxwithshreem4037
    @relaxwithshreem4037 Месяц назад

    Hi @CodeWellTech,
    Great Vedio, with clear explianation but I have a doubt in the below snippet and your statement. Could you please help. Thanks
    const obj = {
    name:'shree',
    age: 23,
    greet: ()=>{
    console.log(`Hello, my name is ${this.name } and I am ${this.age} years old.`);
    }
    };
    obj.greet();
    this in ()=>: Based on the scope of arrow function defined within.

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

    Thank you so much 💞💞

  • @cricminiatures
    @cricminiatures Год назад +1

    Lucid Explanation

  • @hectorserrano9314
    @hectorserrano9314 Год назад +1

    Your last example of the arrow function would've worked with a named function as well 🤔

    • @CodeWellTech
      @CodeWellTech  Год назад +1

      Thanks for your thoughts

    • @hectorserrano9314
      @hectorserrano9314 Год назад +1

      @@CodeWellTech Great walkthrough and thoroughly explained. Thank you so much!

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

    Thank you so much!!!

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

    Hey, thanks for video. Great explanation but I have a doubt.
    const person = {
    name: "max",
    age:19,
    greet : () => {
    console.log(this.name);
    }
    };
    Why it throws undefined?

  • @ohmegatech666
    @ohmegatech666 Год назад +1

    Thanks for the video, but it doesn't explain why in the greet2 function, "this" refers to the Window object. Also it sounds like you're recording the video in a large cave

    • @CodeWellTech
      @CodeWellTech  Год назад +1

      Will make sure everything sounds clear next time. Thanks for feeding and understanding

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

    thanks

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

    why if I use global variable using var not let or const, the value of variable is null if I using this to refer to global object

  • @JimmyKama
    @JimmyKama Год назад +1

    What's wrong with this code? It display "cannot read properties of undefined in the following code..
    var age = 28;
    function displayAge() {
    console.log(this.age);
    console.log(this);
    }
    displayAge();
    var person = {
    age: 26,
    displayAge: displayAge,
    };
    person.displayAge();
    If you use non strict mode, can you please use strict mode since this way is much more acceptable these days. By the way, your method of teaching is really understandable. I feel very sorry why it doesn't work for me! Also, woould you please use a better mic so that we can hear better. There's some noise behind..🙏🙏🙏

  • @surajsomavanshi7804
    @surajsomavanshi7804 Год назад +1

    let name = "xxx";
    const obj1 = {
    name: "myName",
    getName: ()=> {
    console.log(this.name);
    }
    }
    obj1.getName(); // undefined why output is like this in VSCODE?

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

      Since you have defined getName as arrow function and calling getName globally it is undefined. In this case this points to window object. Define getName as normal function then you see output as you expected

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

      If you still want arrow function then use obj1 instead of this when accessing obj1 properties