The problem of this pointing in js

var myNumber = {
  value: 1,
  add: function(i){
    var helper = function(i){
        console.log(this);
          this.value += i;
    }
    helper(i);
  }
}
myNumber.add(1);

Why does this this point to window?? The add method called by the myNumber object, why doesn"t the this in the method point to the myNumber object?

Feb.26,2021

each function has its own scope, and add and helper have their own scope;
your modified call add , add scope this is myNumber , but when the helper function in this scope is called again, there is no modification or display passed in this , so according to the rule, this in helper points to the global window

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2c408-40b3f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2c408-40b3f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?