The only difference between the two codes is where I call the "de ()" function. I left the codepen links below to understand exactly what the problem is. The problem i