<> the front
This is what I use for my notes .
<> one , to json Adding multiple key value pairs dynamically in
For each one in the array json Object dynamic addition n Key value pairs let jsonArray = [ { name: " Zhang San " }, { name: " Li Si " }, {
name: " Wang Wu " } ]; let indexCodeLists = [ { age: "12" }, { age: "16" } ]; for (let
rt= 0; rt < jsonArray .length; rt++) { for (let g = 0; g < indexCodeLists.length
; g++) { jsonArray [rt][`DatumName${g}`] = indexCodeLists[g].age; } } console.
log(jsonArray);---------------------------------> jsonArray = [ { name: " Zhang San ",
DatumName0:"12", DatumName1:"16", }, { name: " Li Si ", DatumName0:"12", DatumName1:
"16", }, { name: " Wang Wu ", DatumName0:"12", DatumName1:"16", } ];
<> two , obtain json Object key and value
let filterJson = { name:" Zhang San ", age:"12", sex:" male " }; for (var key in filterJson)
{ console.log(key); // obtain key value console.log(json[key]); // Get the corresponding value value }
Technology
Daily Recommendation