|
4 | 4 | #### Click :star: if you like it!!
|
5 | 5 | Every contribution counts, regardless of its size. I value and appreciate the efforts of all contributors, from beginners to seasoned developers. Join me on this exciting journey of open-source collaboration. **Together, let's build something amazing!** :handshake:
|
6 | 6 |
|
7 |
| ---- |
| 7 | +--- |
8 | 8 |
|
9 | 9 | #### Contribution Guidelines
|
10 | 10 |
|
@@ -275,7 +275,7 @@ console.log({} === {});
|
275 | 275 | <li><b>Reason</b> : When you compare objects using == or ===, it checks if they refer to the exact same object. So even if they are looking same, they are pointing to different memory locations.</li>
|
276 | 276 | </ul>
|
277 | 277 | </details>
|
278 |
| -
|
| 278 | + |
279 | 279 | **[:top: Scroll to Top](#javascript-output-based-interview-questions)**
|
280 | 280 |
|
281 | 281 | **17. What will be the output**
|
@@ -486,7 +486,7 @@ console.log(cloneUserDetails.address.city);
|
486 | 486 | <li><b>case 1</b> : Although userDetails.age was changed to 22, cloneUserDetails still holds the original value of 20. This is because the spread syntax only creates a shallow copy, so the age property of cloneUserDetails remains unchanged.</li>
|
487 | 487 | <li><b>case 2</b> : The nested address object is still referenced by cloneUserDetails, so when the city property of userDetails.address is changed, it reflects in cloneUserDetails.address as well. Therefore, the output is "Banglore".</li>
|
488 | 488 | </ul>
|
489 |
| -
|
| 489 | + |
490 | 490 | </ul>
|
491 | 491 | </details>
|
492 | 492 |
|
@@ -528,7 +528,7 @@ console.log(arr1 == arr2);
|
528 | 528 | <ul>
|
529 | 529 | <li><b>Output</b> : true, false</li>
|
530 | 530 | <li><b>Reason for console.log(arr1 == str)</b> : Javascript compiler performs type conversion. In this case, it converts the array arr1 and the string str to their string representations and then compares them.</li>
|
531 |
| -<li><b>Reason for console.log(age)</b> : In Javascript arrays are objects and objects are compared by reference. In this case, arr1 and arr2 are pointing to 2 different memory locations</b></li> |
| 531 | +<li><b>Reason for console.log(arr1==arr2) </b> : In Javascript arrays are objects and objects are compared by reference. In this case, arr1 and arr2 are pointing to 2 different memory locations</b></li> |
532 | 532 | </ul>
|
533 | 533 | </details>
|
534 | 534 |
|
|
0 commit comments