0

I've wrote a programm for the console of my browser.

If it's done it returns a result, that I want to save in some way. Afterwards I need to progress some steps in browser manually (the programm isn't running anymore). And the programm runs again and again return a result.

Is there some way to store the combined result?

At the end I always want to return something like:

return storedResults + currentResult;
1
  • So why not make storedResults a global variable? Commented Apr 24, 2016 at 16:49

1 Answer 1

1

If you need to store result of your console applications you can use the Web Storage API.

The Web Storage API provides mechanisms by which browsers can securely store key/value pairs, in a much more intuitive fashion than using cookies.

Save result (three different way to do It):

localStorage.result = 'OK';
localStorage['result'] = 'OK';
localStorage.setItem('result', 'OK');

View result:

console.log(localStorage.result); // print "OK"

See complete reference.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. Didn't know about this one. It is exactly what I am looking for. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.