in my javascript program I have a function (not in my reach to edit) that returns a string or an array.
So I either have the output "one"
or ["one", "two"]
I would like the output to alway be an array, so if it returns one string "one"
I would like to have it as ["one"]
.
What is the most easy way to do this? (Preferably without an if)
I tried:
var arr = aFunction().split();
But when it does return an array, this won't work.