Store class in OOP in JavaScript
Let's implement a Store class that will be a wrapper around the local storage and allow us to easily save and modify the data structures stored in it.
Let's see how we will work with the described class. First, let's create its object:
let store = new Store;
Now let's save the data with the given key:
store.set('key', {a: 1, b: 2, c: 3});
Let's get this data by key:
let res = store.get('key');
console.log(res); // {a: 1, b: 2, c: 3}
Let's get part of the saved structure by specifying several keys separated by a dot:
let res = store.get('key.a');
console.log(res); // 1
Let's get the other part using a complex key:
let res = store.get('key.b');
console.log(res); // 2
Implement the described class.
Create a method that will change data by a given key.
Create a method that will delete data by a given key.