Do not use String as a contructor.
Use the array literal notation.
fileter['x'] is better written in dot notation.
Use !== to compare to undefined.
Fix bad for in variable.
Fix bad for in variable.
Variable reg alread defined.
Fix bad line break, +
Clean comments.
Reformat.