JavaScript "THIS" keyword in 1 Minute

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ต.ค. 2024
  • Full video: • What is THIS keyword i...
    What is the THIS keyword in JavaScript? How does it work and why is it so confusing?
    The THIS keyword, from the series "10 Things JS Developers Should Know"
    by ColorCode.io, Sina Jazayeri
    Today, for episode 6, we’re talking about the THIS keyword, how context and execution logic changes the value of the 'this' keyword, and how arrow functions affect the value? Episode 6: The THIS keyword. Let’s go!

ความคิดเห็น •

  • @intazoid
    @intazoid ปีที่แล้ว +70

    *_this_* was a great explanation 🥁

    • @lsudo
      @lsudo ปีที่แล้ว +1

      @1_________________ interesting name

    • @intazoid
      @intazoid ปีที่แล้ว

      @@lsudo Thanks!

    • @Other-or-so
      @Other-or-so ปีที่แล้ว +2

      This this explanation was this 😁 great indeed, needed.
      This this thing in js is not to be dissed.

  • @AvenDonn
    @AvenDonn ปีที่แล้ว +156

    Screw this I'm going back to C#
    What do you mean this is undefined?!?!

    • @sidheshwartiwari9834
      @sidheshwartiwari9834 ปีที่แล้ว +4

      Lmao 🤣🤣

    • @Jord8043
      @Jord8043 ปีที่แล้ว +10

      My life becomes undefined when working with JS 😅

    • @elenaquerida
      @elenaquerida ปีที่แล้ว +1

      I gave C# a try but it didn't manage to captivate me the way Rust would way later

    • @wassupbaby8634
      @wassupbaby8634 ปีที่แล้ว +1

      Screw that i am going back to python.

    • @Chike_Odor
      @Chike_Odor 7 หลายเดือนก่อน

      I'm coming with. Get ready for some insane boilerplate

  • @edualfred
    @edualfred ปีที่แล้ว +14

    These short videos are amazing! Thank you for sharing your knowledge with us.

  • @federicobau8651
    @federicobau8651 ปีที่แล้ว +1

    Not the full explanation but what u could explain in that short amount of time with such clarity is impressive.

  • @one.mr.benjamin
    @one.mr.benjamin ปีที่แล้ว +1

    Dude. Your way of presentation is soo simple. ❤ thanks

  • @hamadsherazi6896
    @hamadsherazi6896 ปีที่แล้ว +2

    Brother trust me, this is the best content on TH-cam. No one goes that deep on TH-cam as you did in most of your videos

  • @harshithvenkat6446
    @harshithvenkat6446 ปีที่แล้ว +1

    man, your way of explaining is amazing.👍

  • @vikashtiwari6201
    @vikashtiwari6201 ปีที่แล้ว +2

    Its like an Achievement when you completely starts getting this keyword

  • @kanavgupta4930
    @kanavgupta4930 3 หลายเดือนก่อน

    Great explanation 👍

  • @VipulAnand751
    @VipulAnand751 ปีที่แล้ว +1

    In JavaScript everything is by reference useful explanation in this short. Thanks

  • @HamiddNasr
    @HamiddNasr ปีที่แล้ว +1

    That was soo cool!
    Thank you sina :))

  • @_gigachad177
    @_gigachad177 ปีที่แล้ว +5

    Ty sir, I'm learning js rn

  • @yuridesideri7144
    @yuridesideri7144 ปีที่แล้ว +1

    Nice, really like your work!!

  • @nandomax3
    @nandomax3 ปีที่แล้ว +1

    If people started coding with Java, they would have no problem understanding JS this

    • @xskrish
      @xskrish ปีที่แล้ว

      +1

  • @kostas_x
    @kostas_x 10 หลายเดือนก่อน +1

    TIL: Steve Woodmore. I'll leave "this" for another day...🤣 Thank you Sina! You always bring a smile to our faces, no matter the topic. Have you considered Stand up JavaScript comedy?

    • @ColorCodeio
      @ColorCodeio  9 หลายเดือนก่อน

      hah too niche

  • @aamirkhan-jd7mj
    @aamirkhan-jd7mj ปีที่แล้ว +1

    I like your explanation

  • @sach8706
    @sach8706 ปีที่แล้ว

    Este canal es completamente increíble 😼

  • @sobanya_228
    @sobanya_228 ปีที่แล้ว

    Wow, that's a blast from the past.

  • @Uri.Sab.
    @Uri.Sab. ปีที่แล้ว +1

    According Mozilla's docs this is for me the correct way to implementing OOP properly. If you don't code OOP like it suppose to be, this keyword could be a headache... as a C++ programmer i like this in JS. I learned that by hard way uwu

  • @Krazy0
    @Krazy0 ปีที่แล้ว

    I understood what it meant when I heard it's basically self

  • @ildaphonse
    @ildaphonse ปีที่แล้ว +1

    Ok explanation, a little confusing even though it's a simple concept, though very important to go over.

  • @simonshurety3870
    @simonshurety3870 ปีที่แล้ว +15

    I had to google Steve Woodmore...

    • @HariPec-ts1bl
      @HariPec-ts1bl ปีที่แล้ว

      Googling after your comment

  • @azhar6842
    @azhar6842 ปีที่แล้ว

    "this" is the object of which the function is a property of.

  • @tesstrader5908
    @tesstrader5908 ปีที่แล้ว +1

    you said you would help me understand, you have betrayed me

  • @hadawardgz
    @hadawardgz ปีที่แล้ว

    Just to say that in modules or if you are using II(A)FE the keyword this will be undefined

  • @udhayakumarr9392
    @udhayakumarr9392 ปีที่แล้ว

    Can you make a shorts for css rid explanation sir ?

  • @andrewshaban2888
    @andrewshaban2888 ปีที่แล้ว +1

    It's easy when it's not an arrow function

  • @TMinusRecords
    @TMinusRecords ปีที่แล้ว +1

    Wow, I didn't know you could arbituarily set the value of `this` with `.call(val)`. Also, what does `this` outside of a function return when JS isn't being run in a browser (i.e node js)?

    • @ZealForSouls
      @ZealForSouls ปีที่แล้ว

      Google each specifically
      Generally, it's always a kind of a global namespace

  • @MobiusCoin
    @MobiusCoin ปีที่แล้ว

    JavaScript is lexically scoped except for this.

  • @nathanbustamante1525
    @nathanbustamante1525 ปีที่แล้ว

    Most of the time you just need an arrow function

  • @mohammadlee
    @mohammadlee ปีที่แล้ว

    great idea to make shorts on tech! Please don't use an intro in a short. It would be way better without the intro. Subscribed :-)

  • @oleksandrleskiv
    @oleksandrleskiv ปีที่แล้ว

    it depends on where is this

  • @brute9303
    @brute9303 ปีที่แล้ว +1

    where is full explanation. please.. share url...

    • @ColorCodeio
      @ColorCodeio  ปีที่แล้ว

      th-cam.com/video/fVXp7ZWjlO4/w-d-xo.html

  • @radovankrizalkovic9084
    @radovankrizalkovic9084 ปีที่แล้ว

    Full explanation over where mate? Can't find it :(

    • @ColorCodeio
      @ColorCodeio  ปีที่แล้ว

      th-cam.com/video/fVXp7ZWjlO4/w-d-xo.html

  • @AdventMoxy
    @AdventMoxy ปีที่แล้ว

    Confusion and bugs = JavaScript untyped languages

  • @sickair45
    @sickair45 ปีที่แล้ว

    Hard to hear you with the music.

  • @SquaredbyX
    @SquaredbyX ปีที่แล้ว

    Does 'this' have anything to do with the depreciation of the ' var' keyword...

  • @merajkhan5078
    @merajkhan5078 ปีที่แล้ว

    Javascript is really scared me😢

  • @ciprianparaschiv7591
    @ciprianparaschiv7591 10 หลายเดือนก่อน +1

    Dude you're a great teacher. But why do you feel the need to cuss in like 80% of your shorts?

    • @ColorCodeio
      @ColorCodeio  10 หลายเดือนก่อน

      It’s just the way I speak sometimes

  • @ВладимирАндреев-ф6т
    @ВладимирАндреев-ф6т ปีที่แล้ว

    I don't understand with "call"!!!

  • @asdqwe4427
    @asdqwe4427 ปีที่แล้ว

    I have not used it in years

  • @sriharviruma_m
    @sriharviruma_m 27 วันที่ผ่านมา

    what font is that ??

  • @BhupendraXJogi
    @BhupendraXJogi ปีที่แล้ว

    Why are you not uploading anymore??

    • @ColorCodeio
      @ColorCodeio  ปีที่แล้ว +1

      Life events. I'm back as of late September.

    • @BhupendraXJogi
      @BhupendraXJogi ปีที่แล้ว

      @@ColorCodeio glad to see you back

  • @jeetviramgama4392
    @jeetviramgama4392 ปีที่แล้ว

    What's bind?

  • @Mikemestergaming
    @Mikemestergaming ปีที่แล้ว

    I like Java

  • @truedivan
    @truedivan ปีที่แล้ว +1

    Thanks man, appreciate it)
    From Russia

  • @computeraidedyami
    @computeraidedyami ปีที่แล้ว

    what camera do you use to do your videos?

  • @sandysandilya3852
    @sandysandilya3852 ปีที่แล้ว

    I hope and pray God that you understand what you say

  • @69k_gold
    @69k_gold ปีที่แล้ว

    Anything related to web dev makes no sense. That's an intentional feature.

  • @AyyBee1234
    @AyyBee1234 ปีที่แล้ว +3

    I like to see .this as a demon depending on who summons it reflects the personality of that person.
    I am here who summoned me…. wait I summoned me

    • @ColorCodeio
      @ColorCodeio  ปีที่แล้ว +1

      Haha amazing metaphor

  • @donathmm3881
    @donathmm3881 ปีที่แล้ว

    So confusing

  • @sennaevil
    @sennaevil ปีที่แล้ว

    Then take it out of js

  • @5uperM
    @5uperM ปีที่แล้ว

    I hate these quick explanations because they never give you enough time to process what you heard and overwrite it with new information and replace it with visual effects and fluff making you have to rewatch it multiple times and giving them views.

    • @ColorCodeio
      @ColorCodeio  ปีที่แล้ว

      TH-cam Shorts only allow up to 60 seconds. It takes an enormous amount of time and energy to write, record, edit, and animate these videos. Having done this for over decade I can tell you there are far easier ways to get views than to trick people the way you suggested. So, you might not like the format and that's ok, but you are wrong about my intentions.

    • @5uperM
      @5uperM ปีที่แล้ว

      @@ColorCodeio well alright. i hope the actual videos eplain things better.

  • @larssmeets773
    @larssmeets773 ปีที่แล้ว

    How about don't use javascript classes and go for functional programming :)

    • @alext5497
      @alext5497 ปีที่แล้ว

      Absolutely. Dont bother learning stuff you dont like. Its too hars anyway.

  • @fieryscorpion
    @fieryscorpion ปีที่แล้ว +2

    C# is million times better than this miserable language. Lol

  • @TheSmokinApples
    @TheSmokinApples ปีที่แล้ว

    this is why I hate JS

  • @Javascript_view
    @Javascript_view 10 หลายเดือนก่อน

    You make too complicated 😢😢

  • @mhalton
    @mhalton ปีที่แล้ว

    Fail.