Changing JSON data in JavaScript

Let's say we have a string containing in array in JSON format:

javascriptlet json = '[1, 2, 3, 4, 5]';

Let's add one more element to the end of this array. For this we need to take a number of steps.

First, we unpack the JSON into a JavaScript array:

javascriptlet arr = JSON.parse(json);

Add a new element to the array:

javascriptarr.push(6);

And convert the modified array back to JSON:

javascriptlet res = JSON.stringify(arr);

The final code will look like this:

javascriptlet json = '[1, 2, 3, 4, 5]';

let arr  = JSON.parse(json);
arr.push(6);

let res = JSON.stringify(arr);
console.log(res);
Задание 1

The following JSON is given:

javascriptlet json = '["user1","user2","user3","user4","user5"]';

Add another user to the end of the string.

Задание 2

The following JSON is given:

javascriptlet json = '["user1","user2","user3","user4","user5"]';

Change the second user's name.

Задание 3

The following JSON is given:

javascriptlet json = `[
  {
    "name": "user1",
    "age": 25,
    "salary": 1000
  },
  {
    "name": "user2",
    "age": 26,
    "salary": 2000
  },
  {
    "name": "user3",
    "age": 27,
    "salary": 3000
  }
]`;

Add one more employee to this string.