I'm starting to get annoyed when I'm using if statements. Sometimes i'm a bit to fast and i only use one "=" in my IF statement and then run my code. At first glance there is nothing wrong, but as i use my application weird stuff is happening. Then I use some time to go through my code to figure out that i only used one "=" in my IF statement.
So i'd like to know why an IF statement with one "=" get valid?
I remember some time ago when visual studio code would let me know through validation that it wasn't a valid statement. Or is it a vs code change that allow users to use one "=" in their if statements? Or is it just valid code?
if (k = array[i])
{
console.log(k);
}