3 ms·
Thanks for this list, very interesting! I haven't really dealt with this level of JS before, so unfortunately I'm ignorant of every one of your bullet points.
by SCdF 9y ago
Thanks for this list, very interesting!
I haven't really dealt with this level of JS before, so unfortunately I'm ignorant of every one of your bullet points. Good to see it's got lots of uses though.
- masklinn 9y ago> I haven't really dealt with this level of JS before, so unfortunately I'm ignorant of every one of your bullet points. That's not necessarily a bad thing, #1 is mostly of interest to the standard committee and historically considered a bad move (and in fact the source of the issue) for third parties (you may have to use its result if you want to e.g. make one of your objects iterable though), #2 is something you do when all options are exhausted, #3 is when you write your own codegen. #4 is probably the one you're most likely to encounter, it's not that common either, and `null` or `undefined` generally work as sentinels so…
- SCdF 9y agoOh sure, yeah I see how #4 would be useful. Generally I've used / seen `undefined` used for that in the past, which can be problematic because it might mean what you think it means, or it might mean something broken in your algo by mistake.