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:
javascriptlet store = new Store;
Now let's save the data with the given key:
javascriptstore.set('key', {a: 1, b: 2, c: 3});
Let's get this data by key:
javascriptlet 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:
javascriptlet res = store.get('key.a');
console.log(res); // 1
Let's get the other part using a complex key:
javascriptlet res = store.get('key.b');
console.log(res); // 2
Задание 1
Implement the described class.
Задание 2
Create a method that will change data by a given key.
Задание 3
Create a method that will delete data by a given key.