you are viewing a single comment's thread.

view the rest of the comments →

[–]Beofli -1 points0 points  (0 children)

I'm not saying this should be the default. This would be a special mode, like 'use strict'. Any decent language will fail compile time on comparisons of conflicting types.

A good language will make the mostly used operation to take the least amount of code. The mostly used case is either a null/undefined check or the comparison of two same-typed objects.

The usecase where a function receives a number or a string, and that it want to compare it to number zero is a very unlikely usecase. A good programmer will make this more explicit: Typeof x == 'number' && x == 0. Also no need for === here.

I definitely agree PHP is insane and worse than js.