Getting error:
'localStorage' was used before it was defined.
What do I need to do to fix this?
localStorage
is available on all modern browsers and as far as I know does not need to be defined.
Getting error:
'localStorage' was used before it was defined.
What do I need to do to fix this?
localStorage
is available on all modern browsers and as far as I know does not need to be defined.
2 Answers
Reset to default 15Any global that you want to appear as defined to jslint can be defined in a ment of globals. E.g.:
/*global localStorage: false, console: false, $: false */
This would make localStorage, console, and $ (jQuery) not trigger that warning.
It doesn't know how the code will be used. You need to set the browser option. Note this is default in jshint. but not jslint.