Here I refer to a request from the client to the server. After the server receives the request from the route, the function processes it. Does the function involved in the call and the related created variable end the Life cycle after the server returns the data?
Another point of doubt is that nodejs is similar to a function with asynchronous processing. Even if the server responds to the request and ends the request, assuming an asynchronous function is still executing, then the variables involved in the function will be saved. Is the value of this variable the same for other clients?
In nodejs, if you are at the top of a file
var a = 1;The interface requests to print this value and then add it, then this A for each subsequent request will be the last increment …. That is to say, the declaration Period of all variables will always exist after nodejs’s project is started. . .
Continue to look for superior answers. .
In fact, you also know that variables have scopes, and you only get a situation by testing variables in public scopes other than request handler.