The String object does not have a filter method and String is immutable.
So in effect str.split('')
does not change the value of the string but returns a new String which you are not capturing in a variable.
Try,
console.log(str.split('').filter(fil));