It returns a promise which resolves with the result of parsing the body text as JSON.
Exceptions
SyntaxError
Thrown if the string to parse is not valid JSON.
['11', '23', '11'].reduce(
(acc, cur) => (acc[cur] = (acc[cur] ?? 0) + 1, acc),
{},
);
// { 11: 2, 23: 1 }
const t = [{ id: null }, { id: null }];
t[0].id = 1;
t[1].id = 2;
console.log(JSON.stringify(t));
// [{"id":1},{"id":2}]
const place = { id: null };
const t = [place, place];
t[0].id = 1;
t[1].id = 2;
console.log(JSON.stringify(t));
// [{"id":2},{"id":2}]
const place = { id: null };
const t = [Object.assign({}, place), Object.assign({}, place)];
t[0].id = 1;
t[1].id = 2;
console.log(JSON.stringify(t));
// [{"id":1},{"id":2}]