Hi guys,
I’m working on a Js application that uses localstorage to remember a couple variables that alter the application when set. I’m using:
localStorage.setItem('settings',JSON.stringify(this.settings));
to store the information to localstorage, then:
this.settings = JSON.parse( localStorage.getItem( 'settings' ) );
to store settings, if any, into a variable. My problem is that this.settings is a string. I know this, because:
console.log(typeof this.settings);
returns a string. What I want is for an object to be returned, so I can utilize this.settings
like so:
this.state = this.settings.state;
Does anyone see what I might be doing wrong?