+ 1

Variable

I was wondering if it was possible to have variable keep values when we're not using them in JavaScript. For example, if I want to make a survey: I make a variable called surveyAnswers and I want to add one to it each time someone runs the program. The problem is, I have to give a start value to my variable (0) , but then it restarts at 0 every time the program is run. (I'm just a beginner in code, so it would really help if anyone had an idea on this)

3rd Dec 2017, 8:12 AM
Sidox
2 Answers
+ 4
You need to store it somehow, you can use for example session storage, local storage, cookies or database. The choice is yours â˜ș
3rd Dec 2017, 10:45 AM
ThreeG
ThreeG - avatar
+ 1
Okay but... How can I use those?
3rd Dec 2017, 11:11 AM
Sidox