A switch works by comparing what is in switch() to every case . works like: if (cnt === 1) … if (cnt === 2) … if (cnt === 3) … Therefore, you can’t have any logic in the case statements .
A switch works by comparing what is in switch() to every case . works like: if (cnt === 1) … if (cnt === 2) … if (cnt === 3) … Therefore, you can’t have any logic in the case statements .