Store all characters of anotherStr in a direct index table for quick lookup .
let illegal = [ ] ; for ( let i = 0 ; i < 256 ; i ++ ) illegal . push ( false ) ; for ( let i = 0 ; i < anotherStr . length ; i ++ ) illegal [ anotherStr [ i ] ] = true ;