12345678910111213141516171819202122232425262728 |
- let persons = [
- {
- name: 'Sergey',
- surname: 'Honcharenko',
- age: 28,
- isMarried: false,
- },
- {
- name: 'Andrew',
- surname: 'Klymchuk',
- middleName: 'Anatoliyovych',
- haveAJob: true,
- },
- {
- name: 'Alexander',
- surname: 'Slobodian',
- sex: 'male',
- hasAPet: false,
- }
- ]
- let parsedPerson = JSON.parse('{"name":"Elena","surname":"Mospanyuk","education":true,"height":170}');
- console.log(persons.concat(parsedPerson));
- // или
- console.log(Object.assign(persons, parsedPerson));
|