News for hackers. Stuff that matters.
Re:JavaScript Equality Minesweeper by z3t4 on Wednesday September 19, 2018 @04:20AM (#18022692)
The only problem I can see is mixing strings and numbers. But there are probably more errors someone pro types would say is type errors while someone pro dynamic/loose typing would say is not ... Here's a nasty bug that took me like two hours to debug (this is only two lines, but imagine a sea of code where such thing could easily hide). Can you spot it ?

    var foo = [];
    foo.push["bar"];
You could say it's a type error. It's however not caught by neither TypeScript or Flow.
Re:JavaScript Equality Minesweeper by sonnyblarney on Wednesday September 19, 2018 @04:40AM (#18022781)
If you want to type an array, you can do that in Typescript.

let x:number[] = []; x.push("x");

Here, the transpiler will catch the error of trying to push a string to a number array.

Typing is your friend, and it will in almost all cases help you write cleaner and safer code.