Task 2

Explain this code line by line
mail@pastecode.io avatar
unknown
javascript
2 years ago
609 B
1
Indexable
Never
const person = {
  name: "Muhammad",
  age: 30,
  isAlive: false,
  salary: 20000,
  children: [
    {
      name: "Omar",
      age: 8,
      fatherless: false,
      starving: false,
    },
    {
      name: "Khaled",
      age: 10,
      fatherless: false,
      starving: false,
    },
  ],
};

person.children[0].name = "Mahmoud";

if (!person.isAlive) {
  !person.children[0].fatherless;
  !person.children[0].fatherless;
} else if (person.salary < 20000) {
  !person.children[0].starving;
  !person.children[0].starving;
} else {
  console.log("Everything Is Fine!");
}