James
James

Reputation: 43627

jQuery split problem

I have a script, which returns value as an object. It can return text or numbers, like 'hello, goodbye' or '500, 900'.

When I try to use split() with this object, I catch an error:

TypeError: Object 'hello, goodbye' has no method 'split'

But I want to use split. What can I do?

Seems the only way to convert this object into a string, how to do that?

Upvotes: 1

Views: 2833

Answers (1)

roberto tomás
roberto tomás

Reputation: 4687

does a = a+''; a.split('') work? that should convert the object to string before split is called.

Upvotes: 5

Related Questions