How to print newly entered data into console

Their is some data stored in local storage, present iam pushing new data into local storage… the new data is also visible at local storage but on the page refresh it is deleting and when iam going to print that in console without refreshing the page … Only old data was printing… How to solve this…???

I need to keep the newly entered data after refresh also … and that should also printed on console

1 Like

@kollidayakar77 ,
Use the local storage method for set and get data

//Get data
let localTeam = JSON.parse(localStorage.getItem("data"));

//set data
localStorage.setItem("data", JSON.stringify(localTeam));