Hello, I'm using the store.js library to make it easier and I'd like to know how I can check to see if a key exists in storage.
Thank you for your attention and good evening: D
Hello, I'm using the store.js library to make it easier and I'd like to know how I can check to see if a key exists in storage.
Thank you for your attention and good evening: D
store#get()
returns the value of its key, if it exists, otherwise that value will be undefined . Then you can use it to check if something is set for a particular key:
if(store.get('chave')){
// Existe.
}
I've created an example in jsfiddle because the snippets here in StackOverflow do not allow the use of storage :