Answers for "update data in json using javascript"

0

update data in json using javascript

function setUsername(id, newUsername) {
  for (var i = 0; i < jsonObj.length; i++) {
    if (jsonObj[i].Id === id) {
      jsonObj[i].Username = newUsername;
      return;
    }
  }
}

// Call as
setUsername(3, "Thomas");
Posted by: Guest on January-13-2021

Code answers related to "update data in json using javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language