[Javascript] Flattening nested arrays: a little exercise in functional refactoring

NoSuchKey