JavaScript's String.split () method does not work in firefox

I am trying to break a string in javascript. it works fine in chrome but it doesn't work in firefox

code

var a="1#abc"; var b=a.split('#'); 

Error on cole TypeError: response.split is not a function

The answer in firefox is missing from the line. It's like [Object XMLDocument] It is not converted by the toString() method. HowI can convert it to string

+4
source share
1 answer

I don't know what is going on, but you can try converting the variable to a string before splitting:

 var a="1#abc"; var b=a.toString().split('#'); 
+33
source

All Articles