I don't think we can rely on `filter` being available cross browser.  Maybe try `input.match(RegExp(".{1," + n + "}", "gm")` instead to avoid empty strings all together?