// object links // -------------УСЛОВИЕ------------- // Добавьте персоне гаджеты, используя новые поля smartphone и laptop в объекте персоны // Добавьте владельца в гаджеты, используя новое поле owner в объектах телефона и ноутбука. // обратите внимание на цикличность ссылок в объектах, если вы все сделали правильно, то // person.smartphone.owner.laptop.owner.smartphone == person.smartphone // -------------РЕШЕНИЕ------------- const task03block = document.createElement('div'); task03block.style = "border: 2px solid green; border-radius:5px; margin-bottom:10px; padding:10px"; const task03title = document.createElement('h2'); task03title.innerText = 'Task-03 Object links'; const checkBtn = document.createElement('button'); checkBtn.innerText = 'Check the circle link'; checkBtn.style = 'margin-bottom:10px'; root.appendChild(task03block); task03block.appendChild(task03title); task03block.appendChild(checkBtn); checkBtn.onclick = () => { const good1 = document.createElement('div'); const good2 = document.createElement('div'); const good3 = document.createElement('div'); var notebook = { brand: "HP", type: "440 G4", model: "Y7Z75EA", ram: 4, size: "14", weight: 1.8, resolution: { width: 1920, height: 1080, }, }; good1.innerText = "Notebook:"+JSON.stringify(notebook); task03block.appendChild(good1); var phone = { brand: "meizu", model: "m2", ram: 2, color: "black", }; good2.innerText = "Phone:"+JSON.stringify(phone); task03block.appendChild(good2); var person = { name: "Donald", surname: "Trump", married: true, } good3.innerText = "Person:"+JSON.stringify(person); task03block.appendChild(good3); notebook.owner = person; phone.owner = person; person.smartphone = phone; person.laptop = notebook; const circleLink = document.createElement('p'); circleLink.innerHTML = `Check result: Expression "person.smartphone.owner.laptop.owner.smartphone == person.smartphone" returns ${person.smartphone.owner.laptop.owner.smartphone == person.smartphone}`; task03block.appendChild(circleLink); }