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); ...
newcomers ask for help. Now you use superagent on node to send a request to access several ports. You need to save the cookie obtained by the first request and let the later request continue to use. It just happens that there is a special agent () metho...
the effect I want to achieve is that when I delete the last tag, I show the template on the home page. I use $router.push, but it doesn t work. I can use $router.go, directly but refresh the page. Solve? if(this.mainNav.length == 0){ ...
setTimeout(function(){ console.log( D ); },0) var promise = new Promise(function(resolve, reject){ console.log( A ); resolve( C ); }) console.log( B ); promise.then(function(value){ co...
1. A matching pattern in the .gitignore file is debug.log, which can match debug.log files in the Filter repository, including: debug.log logs debug.log;, but if I write logs debug.log, it matches only logs debug.log, not Filter, debug.log,build logs deb...
how to calculate left and top in rotation after getting the matrix? <div style="width:100px;height:50px;"> < div> div.style.transform = `rotateZ(45deg)` let transform = window.getComputedStyle(div)[ transform ], matrix =...