Hacker News new | past | comments | ask | show | jobs | submit login

js doesn't have this particular problem, but it does have both `null` and `undefined`, which will have varying semantically different usages depending on local conventions.

For example, some will prefer to use `null` to mean that a value is _intentionally_ missing (for example, the db explicitly returned a null value), while `undefined` does not have any such connotation. These exist for frontend engineers to navigate decisions often far removed from their influence.

Anyway, `null != ''` and `null != 'null'`, but `null == undefined`. However, `null !== undefined`.

A lot has been made of js Truthy/Falsy equality operator, but most js programmers will take steps to actively avoid it coming into play. Probably the `void` operator is still under-used though in frontend code, though, since there's some pretty surprising legacy things that can happen when interacting with DOM APIs (like `checkbox.onclick = () => doSomething()` resulting in different checkbox behavior depending on whether or not `doSomething` returns a boolean or undefined).




I treat usage of `==` in JavaScript as undefined behavior.


I kinda want to change my middle name to "undefined" now.

I wonder if I could legally define my middle name as starting with a lowercase letter.


I would call myself a relatively good developer and I fully understood type checking occurred via ===, and compare by value caught me. In my defence, I assumed this was less of an issue in modern JS, but thou shall not break backward comparability, apparently.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: