I need some help with express: I have a variable in express that is called lastQuestion, to remember the last question even when assigned across multiple functions.
here's a simplified version of my code:
var lastQuestion; function sjhda(){ //uses the variable lastQuestion = generateQuestion(); return(lastQuestion); } function asjhasd(){ //uses the variable lastQuestion = generateQuestion(); return(lastQuestion); } function asjhd(){ //uses the variable lastQuestion = generateQuestion(); return(lastQuestion); }
Let's say that two clients are using the website and this happens:
1: client one starts using the bot, and begins to answer the question (and variable lastQuestion!) "How are you?" 2: client two who is already on generates a new question, and begins to answer the question (while resetting lastQuestion), "What are the odds of death?" 3: client one submits the answer "great". now the answer to the question "What are the odds of death?" has been saved as "great". How can I fix this? Also, I'd like to avoid using cookies if possible. Thanks!
https://stackoverflow.com/questions/65535070/localizing-variables-in-express January 02, 2021 at 08:44AM
没有评论:
发表评论