https://scrimba.com/scrim/co099492d8d210ac5eb34cb4f?a=17807.0.3.L17_27
I am not understanding why I’m experiencing an issue when trying to render the next dog on screen
7 messages · Page 1 of 1 (latest)
https://scrimba.com/scrim/co099492d8d210ac5eb34cb4f?a=17807.0.3.L17_27
I am not understanding why I’m experiencing an issue when trying to render the next dog on screen
It basically all boils down to this line:
let newDog = dogs[dogsArray.shift()]
As an additional hint, add console.log(doge); as the first thing you do in your render() function to see what your doge variable points to when you render.
You have problem with the following line:
let newDog = dogs[dogsArray.shift()]
.shift() take out the first element of the array and returns it.dogs not dogsArraydogs array: return newDog ? new Dog(newDog) : {}null instead of an empty object, then check against that value and render something else out if you don't have more data leftOkay so I changed my code to:
const newDog = dogs.shift()
which now works but for some reason not on the first click which is very strange to me. Do you guys know why?
Also how do you put code here on discord that looks like that. I never understood how lol