local storage in angaulr 1

local storage in angaulr

let data = {"Name","Naveed"}
var show = localStorage.setItem("dataSource",data);

Here is what the above code is Doing:
1. We are creating a variable called data and assigning it a value of an object with two properties: Name and Naveed.
2. We are creating another variable called show and assigning it a value of the localStorage.setItem() method.
3. The localStorage.setItem() method takes two arguments: the key and the value. In our case, the key is dataSource and the value is the data variable.
4. We are then logging the value of the show variable to the console.

Now, let’s see what happens when we run the above code:

Similar Posts