look at the following code: function test(){ console.log(this === window); show(); window.show(); function show(){ console.log(this === window, fn ); } } function show(){ console.log(this === window, local ); } tes...
var a = 10; var obj1 = { a: 20, fn: (function() { this.a *= 2; a = 5; var a = 6; return function() { this.a *= a; console.log(a) } })() } var obj2 = { a: 30 } var fn = obj1.f...
< H1 > Code < H1 > undefined (node:5784) UnhandledPromiseRejectionWarning: TypeError: Cannot read property name of undefined at say (D: NodeJS Test test2.js:18:22) ...
in jQuery ajax, why does the this under the data attribute point to my vue instance? As follows: vue data(){ return{ name: test , age:18, } } ajax methods:{ getData(){ $.ajax({ url: test.php , type: post , ...
Why is the value of this tag 1 and this tag 2 different when the second callback is made by the two calls ? function a (val, callback) { callback.call(a,val,callback) } a(1,function b (val ,callback) { console.log(this, 1 ) ...
1, commonfun.js: export default { va:{ 000 : "0", 001 : "1", 002 : "2 }, func:(retcode)=>{ console.log(this); return this.va[retcode]; } } 2, main.js: import vue related dependencies im...
these two are learning the relevant syntax of ES6. When I learned about the this problem of the arrow function, when I compared it with the this in ES5, I found that the following line of code got incredible results: var age = 77; function foo() { ...
when I read the book introduction to ES6, I introduced the arrow function this . The immobilization of this is not because there is a mechanism for binding this inside the arrow function, but because the arrow function does not have its own this, at al...
JavaScript Advanced programming (3rd Edition) P144 the meaning expressed in (2). It s not what I understand. -reference elevation content start- English explanation To create a new instance of Person, use the new operator. Calling a constructor i...
Test and reflection triggered by the "Communication between non-parent and Child components " section of the official website tutorial: is about creating two child components, and the value of component an is passed to component b. <!DOCTYPE html&...
code <script> var num = 100; var obj = { num: 200, inner: { num: 300, print: function () { console.log(this.num); ...