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,
- }
- ]
- for (let key in persons) {
- if('name' in persons[key] && 'surname' in persons[key] && 'middleName' in persons[key]) {
- persons[key].fullName = `${persons[key].surname} ${persons[key].name} ${persons[key].middleName}`;
- }
- }
- console.log(persons);
|