TypeError: Cannot read property 'indexOf' of undefined

Also - I’m not sure that .join is a method of string objects in JS - you might need to use concat() instead