Skip to content

Commit

Permalink
Merge pull request #26 from suman-saket/patch-1
Browse files Browse the repository at this point in the history
2 object Question Added
  • Loading branch information
sadanandpai authored Oct 23, 2021
2 parents f5518e9 + cfdce4b commit 524b78a
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions code-snippets/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,77 @@ console.log(TDK);
</li>

---
<li>

**What will be the output?**

```JS
let myName = 'Sunny';
let groupName = myName;

myName = 'DevKode';
console.log(groupName);


const obj1 = {
id:1,
name:"Sunny",
}

const obj2 = obj1;
obj2.name = 'DevKode';
console.log(obj1);
```

- A: `Sunny , { id: 1, name: 'Sunny' }`
- B: `DevKode,{ id: 1, name: 'Sunny' }`
- C: `DevKode,{ id: 1, name: 'DevKode' }`
- D: `Sunny,{ id: 1, name: 'DevKode' }`

<br/>
<details>
<summary><b>Answer</b></summary>
<p>

#### Option: D

</p>
</details>
</li>

---

<li>

**What will be the output?**

```JS
function greet(person) {
if (person == { name: 'Narendra Modi' }) {
return 'hey Narendra Modi'
} else {
return 'hey Donald Trump'
}
}

console.log(greet({ name: 'amy' }))
```

- A: `hey Narendra Modi`
- B: `hey Donald Trump`

<br/>
<details>
<summary><b>Answer</b></summary>
<p>

#### Option: B

</p>
</details>
</li>

---


</ol>

0 comments on commit 524b78a

Please sign in to comment.