Reputation: 1503
Safari 6:
> ['a=23', 'b=234', 'c=23'].join('&');
"a=23&b=234&c=23"
then with a variable I need to do this with. it's
jsss
[
Array[8]
0: "s=1"
1: "l=NTA4NTQzNnw0NzczOTg"
2: "r=-1"
3: "t=a"
4: "m=0"
5: "si=5156695"
6: "u=5085436"
7: "sn=mip"
length: 8
__proto__: Array[0]
]
> jsss.join('&');
"s=1,l=NTA4NTQzNnw0NzczOTg,r=-1,t=a,m=0,si=5156695,u=5085436,sn=mip"
Why does it seem to ignore the separator?
Upvotes: 5
Views: 3069
Reputation: 7134
It looks like you have an array with a nested array, so you're only calling join on the top array which only has one element (the child array) and therefore just echoes that array with default behavior and nothing to delimit.
Upvotes: 12
Reputation: 97672
There is only one item in the jsss
array so there is no use for the separator. I think what you want is jsss[0].join('&');
Upvotes: 6