JavaScript this Keyword Explained Simply

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

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

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

    💙 Twitter: twitter.com/realDevSage
    📙 Ebooks: payhip.com/devsage
    💥 Discord: discord.gg/BP8wPv6raA
    👕 Merch: cottonbureau.com/people/devsage

  • @andyryan2945
    @andyryan2945 Год назад +25

    Seriously great explanation! Came here for more clarification on it after The Odin Project lesson Objects and Object Constructors

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

    'This' references to the object that calling the function.
    This simple sentence cleared my mind after reading a lot of stuff about 'this'. Your explanation is amazing!!

  • @JohnBogart-o9l
    @JohnBogart-o9l 6 месяцев назад +2

    Amazing explanation, much more concise than articles I've read.

    • @DevSage
      @DevSage  5 месяцев назад

      Glad it helped!

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

    Finally someone that doesn't speak overly fast

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

    Appreciate all your useful vids. They've substantially benefited me in the first couple months I started out.

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

    Bro, that arrow function confused me while reading an article T - T. Thanks man!

    • @DevSage
      @DevSage  5 месяцев назад

      Happy to help!

  • @ArunaTebel
    @ArunaTebel 2 года назад +8

    Thanks a lot. One of the clearest explanations of `this`. 🔥

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

      No problem, Aruna!

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

    I've been struggling to fully comprehend this; your video really helped me out. Looking forward to checking out more of your vids ;)

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

    i really want to say thank you because your simple explanation made me get it finally

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

    best tutorial on "this" subject

    • @DevSage
      @DevSage  5 месяцев назад

      Thanks!

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

    Very clear explanation ..

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

    Very nicely explained. Thanks

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

    Very clean explanation, thanks for that!

  • @chetanbawankule-w3h
    @chetanbawankule-w3h 2 месяца назад

    Brilliant explaination.

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

    So, could we say that using inline functions with the `this` keyword is discouraged (bad practice) since it would require it being nested within a normal function?
    Meaning that instead of using an inline and nesting it, It's better to simply just use a normal function? Please correct me if I am mistaken! :)

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

    Very good and instructive explanation

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

    Great explanation, thank you!

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

    best video on this topic! ty.

    • @DevSage
      @DevSage  5 месяцев назад

      No problem!

  • @KennehGebra-cf9ds
    @KennehGebra-cf9ds 9 месяцев назад

    I subscribed because i was able to understand "this"

    • @DevSage
      @DevSage  5 месяцев назад

      Thanks!

  • @a-mok-youb
    @a-mok-youb Год назад

    Is it possible to import any module without writing the module type and export it

  • @Vamsikrishna-mf6ye
    @Vamsikrishna-mf6ye Год назад

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

    was very helpful, thanks ..

    • @DevSage
      @DevSage  5 месяцев назад

      You're welcome!

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

    9:53 Could you just use an arrow function with the forEach method/function to solve the "this" problem?

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

    a big thumb up for you, thank you!

  • @FurkanKARADENIZ-tt8zf
    @FurkanKARADENIZ-tt8zf 4 месяца назад

    I am okey with this topic but, i have a question. When i use this keyword on a object literal like 'fullName : this' it says it is a global object and this kind of little things confuses me. Thank you.

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

    you are a legend

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

    Thanks!

  • @spageen
    @spageen 11 месяцев назад

    this is awesome

    • @DevSage
      @DevSage  5 месяцев назад

      Thank you

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

    on forEach (8:02) when this refers to window object why dont we use arrow function for ex: this.hobbies.forEach((hobby)=>{ ( console.log( this.firstName )} ));

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

      You can, i guess he just wanted us to learn how to fix it without changing the callback function type.

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

      Right , but its more interesting to do that way for the sake of concept and learning isnt ?

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

    Great explanation, thanks!