Questions about the use of global variables in node?

such a scenario:

let g=""
router.get("/",function(req,res,next){
 /*g*/
 g="date"
}
router.get("/next",function(req,res,next){
  /*g*/
}

every time the user enters / assigns the global gjinghort next route, it needs to operate according to g. If the null value jumps /, it is not a null value to proceed to the next operation.
if user An enters first, modify the gaming matching data Aids, and then user B goes to modify the gaming matching data Bones. If user A requests / next, at this time, the g value should be dataB, but will actually operate further according to dataA, g is a global common variable, and B enters after A, why do you operate according to dataA?

Apr.07,2021

Global public is not so public. According to your idea, increase household use. If this is the case, the money in your account will easily become my money.
the overall situation is aimed at the user process

.

for example, I have such a program

var i
function add(){
    console.log(i+2)
}

the output of the first execution is 2, and the second execution is 2. No matter how many times you execute, always output 2

.

according to your understanding, the output is 2 for the first time and 4 for the second time. Do you think this is possible?


All variables created in the

node module are local variables and are played in closures from beginning to end.

Global variables can only be provided by node, and can be provided by global


what the landlord needs may be a cookie, instead of a global variable

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-1e5af6f-455ec.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-1e5af6f-455ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?