How to update json value in localstorage
You need to set the object back again like you did originally, right now you are storing only a number, not the object.
var persons = JSON.parse(localStorage.persons);for (var i = 0; i < persons.length; i++) { if(inputName === persons[i].name){ //look for match with name persons[i].age += 2; //add two break; //exit loop since you found the person }}localStorage.setItem("persons", JSON.stringify(persons)); //put the object back