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

> Personally, I've come to see this ubiquitous string of symbols, ?? "", as the JS equivalent to .unwrap() in Rust

It's funny you bring this up because people opposed to `.unwrap()` usually mention methods like `.unwrap_or` as a "better" alternative, and that's exactly the equivalent of `??` in Rust.



Semantically the two are kind of opposite; the similarity is that they're the lowest-syntax way in their respective languages to ignore the possibility of a missing value, and so get overused in situations where that possibility should not be ignored, leading to bugs.


This is exactly what I was trying to communicate in the article. You've put it in a way clearer way here though. Thank you:)



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

Search: