JSFiddle - React, Tailwind, and code Playground
by fristyr
JavaScript
let person = {};
person.firstName = 'Denis';
person.secondName = 'Goncearuc';
person.gender = 'Male';
person.age = 'Beverwijk'
person.city = 'Beverwijk';
person.country = 'Netherlands';
console.log(`Hi! My name is ${person.firstName}. My second name is ${person.secondName}. I am from ${person.country}`);
let porscheCarrera911 = {};
porscheCarrera911.mark = "Porsche";
porscheCarrera911.model = "Carrera 911";
porscheCarrera911.year = 2018;
porscheCarrera911.color = "Blue";
porscheCarrera911.power = "450 h.s";
porscheCarrera911.acceleration = "3.6 s";
porscheCarrera911.speed = "306 km/h";
porscheCarrera911.width = "1,852 mm";
porscheCarrera911.length = "4,519 mm";
porscheCarrera911.owner = person;
console.log(porscheCarrera911.owner);
console.log(Object.keys(porscheCarrera911));
//Почему person.car === car ? Потому что ссылка на объект в моем случае это porscheCarrera911
//Почему person === car.owner ? Потому что ссылка на объект персоны.
//Почему person === person.car.owner ? Owner --> ссылается на объект car тот в свою очередь ссылается на person.
console.log('***************************')
const arr = Object.keys(person)
console.log(arr)
user = Object.create(person)
console.log(user)
for (let value of arr) {
user[value] = person[value]
}
console.log(user)
console.log('************16***************')
let building = {
house: 'дом',
floors: '1',
city: 'Beverwijk'
}
console.log (building)
person.city = building.adress
building.owner = person