by eranation · 5mo ago · 0 comments
Incidentally it’s also a great introduction to thinking as a functional programmer if you are used to imperative logic with state spread all over the place.
1. He calls Array(16) and then talks about there being 16 separators. Of course, there are only 15. This kinda breaks the Batman joke.
2. He writes {}+[] and claims that he's adding a list to an object, then mocks the fact that it gives a different result than []+{} which gives [object Object]. In reality, if you write ({}+[]), you also get [object Object]. I'll leave it as a puzzle for you to figure out why {}+[] is different. (Hint: Gurer vf ab bowrpg gurer.)
> {}+[]
'[object Object]'
> []+{}
'[object Object]'
... because Node's REPL and some consoles pre-wrap input that looks object-ish :)