The JavaScript one is incorrect. It should use the length of the 2nd list rather than stop at the first falsy value in it.
That's where I stopped reading. Even going in, I wondered doesn't each of these languages already have a function in stdlib or a de-facto package with it?
That's where I stopped reading. Even going in, I wondered doesn't each of these languages already have a function in stdlib or a de-facto package with it?