Keeping Track of "This" in JavaScript

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.พ. 2025

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

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

    Thank you so much. I have been struggling in understanding the concept of "this" f. It's solved within just 13 mins by watching this video.

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

    Excellent tutorial of ```this``` keyword. Googled a lot for a better explanation on ```this``` keyword, but this is the best explanation one can get.

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

    My sincere and appreciative thanks for giving a pretty thorough explanation of such a mysterious and at times, misunderstood feature in JS.

  • @endsublea
    @endsublea 8 ปีที่แล้ว +9

    R.I.P Harambe

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

    leave it to o'reilly to make things even more confusing

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

    So I have a question... Which procedure to follow to call a function which is not part of a obj. Sending this as an argument or using .call().
    And the must answer question would be.. Why to opt for that solution rather than other one?

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

    I feel like that first "banana slip" is more of a scope issue, than a THIS issue.

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

    Well Explained!!

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

    One little suggestion: if the cursor is able to point at the words corresponding to the voiceover, it would be more helpful.

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

    What is the difference between methods and functions in JavaScript? Is the method and object same thing here?

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

      Method is a function within an object. From example below... "myFunction" is a method of "x".
      var x = {
      myFunction: function() {
      console.log('hello")
      }
      }

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

    I can't hear anything is it muted?

  • @75blackviking
    @75blackviking 7 ปีที่แล้ว

    Excellent video. Just want a banana now....

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

    'This' is interesting!

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

    nice one

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

    You speaking way to fast about this topic, when there is so many redundant words its really hart to grasp the concept.

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

    'this' is a lot similar to 'self' from other languages like python.

    • @fanreymysterio619
      @fanreymysterio619 10 ปีที่แล้ว

      This is reffering to the object, as in other programming languages. You are correct :P

    • @TheCrimson147
      @TheCrimson147 9 ปีที่แล้ว

      +triforcelink Why no one said this to me before, they all act like "this" is a very unique feature? ;_;

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

      triforcelink "this" in JS is not the same as "self" in Python. In JS the value of "this" changes depending on how the function was called. You actually can't always tell what the value of "this" is without looking at how the function was called. There are 5 different rules, view the video for examples.

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

      this is only similar to Python's self when you're using it from inside a constructor function where this(like self) refers to the newly created object

  • @passsigns8354
    @passsigns8354 7 ปีที่แล้ว

    I recommend not covering the code with "the results". It makes it difficult to look back and forth and compare.