var o = {
a:11,
b: () => {
console.log("this is", this);
}
}
o.b();
Why does this point to window?
var o = {
a:11,
b: () => {
console.log("this is", this);
}
}
o.b();
Why does this point to window?
() => { }thisthis
arrow function () = >
function is the object in which it is defined, not the object in which it is used. The direction of the
this object is variable, but in the arrow function, it is fixed.
the arrow function this points to the superior, o defines that all this points to window
without the arrow function this refers to o this object, o actually the this in the window.o, arrow function will indicate that the outer this, is the this, under window, of course it is window.
Previous: Do you still need import after the introduction of vue and axios through cdn?
Next: Hexo cannot be accessed
In the scenario, the front end uploads the file to node api,api through xhr and calls the upload method put of Aliyun oss sdk (or multipart), Aliyun is responsible for uploading the file to oss.. Well, the problem is that when the front end monitors the...
through the goto to the download link, the exe file will be displayed, saved or discarded when the download is complete. how do I write code to save it automatically? ...
it feels like you can t manipulate json,. At most, it s an array. ...
after installing the extension of nunjucks, when you open the template file of nunjucks, you will be prompted that there is no formatter for the nunjucks file when you format the file. how to format the template file of nunjucks? ...
ask: v-for n child components in the parent component, and there is a value in the child component. Pass the value value $emit to the parent component. Why can the parent component only receive the value of the first child component, and why can t the...
shouldn t vue use vue-router? Why can it only be put into devDependencies (development dependency)? ...
for example, [ "1 ", "] I want to get the element in the array that is not ", that is, the return result is " 1 "....
question 1: why is the middleware in the koa2 framework written in the form of async, rarely in Synchronize mode (that is, without async)? For example, app.use(async (ctx, next) => { const start = new Date() await next() const ms = new Date() ...
A project of practicing hands. I want to climb the singer information on NetEase Cloud code is similar to . const request = require( superagent ); const cheerio = require( cheerio ); request .get( http: music.163.com -sharp discover artist ca...
recently, when I was writing a node project, I found that it was troublesome to write a bunch of sql statements when connecting to mysql with node.js. I went to npm s official website to search for nothing, so I would like to ask if there is a similar f...
how does react ant use custom form validation? 1. Code const Login = ( { loading, dispatch, form: { getFieldDecorator, validateFieldsAndScroll }, } ) => { function handleOk() { validateFieldsAndScroll((error...
Let the boss take a look. What I want to ask is, can I set the default style of the damaged image when img is empty? ...
ask for answers from all kinds of gods ...
simply write a project with ant-design-pro, and write a server.js and npm run build packaged file in the root directory with the built-in mock API,. The dist directory is as follows: server.js: server.js302Cannot read property notifyCount of unde...
the program node is currently not installed? here are the installation steps: enter the command: wget https: npm.taobao.org mirror. xz-d node-v8.9.3-linux-x64.tar.xz or tar-xzvf node-v8.9.3-linux-x64.tar.gz tar-xvf node-v8.9.3-linux-x64.tar ...
npm link npm WARN app@1.0.0 No repository field. up to date in 0.724s npm ERR! path C: Users Cooper AppData Roaming npm node_modules app app npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall chmod npm ERR! enoent ENOENT: no such file o...
the problem is this: when the foreground wants to modify, click modify, and then the background gives out the mod_data and then you can modify it. I know that the problem is probably the problem here with default. The first time I clicked on the banne...
prompt for an error when running npm install module.js:549 throw err; ^ Error: Cannot find module update-notifier at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.requ...
error installing Times $ yarn global add weex-toolkit yarn global v1.2.1 [1 4] Resolving packages... warning weex-toolkit > weex-builder > babel-preset-es2015@6.24.1: ? Thanks f or using Babel: we recommend using babel-preset-env now: please rea...
Today, when you look at the content of the node middleware section, it feels a lot like a filter, so is the so-called middleware another name for a filter? ...