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");
Also in JavaScript:
- javascript how to split array into subarrays javascript
- javascript format number as currency
- validate form in reactstrap modal api
- httpget javascript
- javascript shift
- Value of type 'typeof ValidatePassword' is not callable angular material
- js set css variable
- how to add objects in array
- all math methos js
- jquery test div exists
- simple express server
- mongodb unwind
- javascript loop through class elements
- how to make a github api using react
- remove the items in array which are present in another javascript
- Js Swiper
- select parent of elemt
- vscode angular: running ngcc
- localstorage.getitem()
- js remove json value duplicates
- type a promise
- object object javascript
- Difference in push and navigate in react Navigation
- javascript if contains character