14

So recently I needed to make a little Tic-tac-toe game with Node.JS for an university project. I previously learned Java and C# so Javascript as a non-compiled, script based language was something new for me.

Now during the programming process I reached the point where I needed to implement a function to change the player who's playing.

I was testing the game and... It seemed like the player was changed twice so it immediately switched back to the previous player.

Using a lot of console.log's I finally stumbled upon the error... (since Javascript or at least Visual Studio Code, I honestly don't know, doesn't have any kind of debugger or something).

Why the fuck does js allow to make allocations in if conditions?

I accidentally wrote one '=' instead of three '==='.

No error, no warning... Nothing.

Since then js and me are not friends anymore.

Comments
Add Comment