Doubts and Clarifications

Javascript

1. How to set an image src in JS?

In PIG Game, we set image src like this,

document.querySelector('.img').src = "img.png"

The doubt is, when do we use load event since setting img src is async operation?

2. Spread operator [...] creates a shallow copy of array. Can we create a deepcopy and how? Also for objects?

3. In react, a variable is not working that is defined outside JSX

React slider project john's milga https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=11303s&ab_channel=freeCodeCamp.orgfreeCodeCamp.org

Last updated

Was this helpful?