+ 1
What is wrong with this code
2 Answers
+ 5
You created the Button in btn(), which is called after 1000millisecond, but your querySelector of class btn is instant.
Put the querySelector in setTimeout anonymous callback.
https://code.sololearn.com/WLPX3FxTU2K3/?ref=app
+ 3
Abbakar_ahđ»đ» Remove setTimeout and call function before calling the event listener.
Remove this:
setTimeout(() => {
btn()
}, 1000)



