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

"try a little array in the console, if Array.keys() returns the orders keys, I will assume it is"

That may work for some toy script you write for your own use, but must be avoided if you intend to engineer a program.

Certainly, that kind of thinking will lead to very bad results if you ever do low-level multi-threaded programming or try to write portable code.

For multi-threaded programming, "is this call thread-safe?" is not something answered in a test, and certainly not in a quick test.

For portable programming, you simply cannot run the test on all possible systems.

In general, when you program like that, you will not only rely on implementation details that may change (for example, this may change for arrays with lots of entries) but also forget to handle error conditions.



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

Search: