Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Yes it is. It demonstrates weak typing which I also think is broken.

For the third time, no. There is no implicit conversion process during the comparison, the default comparison is explicitly specified to convert both of its arguments to strings before doing the comparison.

Javascript does not trigger conversions to compare two numbers, so relying on the type system would actually do exactly what you want.

> You broke it by writing more code.

Meanwhile you completely missed the point of posting the snippet.

> Javascript is broken __unless__ you write additional code.

And as I replied the first time around, I have no objection with the assertion that the default sort comparison function is garbage, I have an issue with your assertion that it is a consequence of weak typing because it is not.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: