Task 2

Explain this code line by line
 avatar
unknown
javascript
3 years ago
609 B
4
Indexable
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!");
}
Editor is loading...