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?
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?
Share Improve this question asked Oct 6, 2012 at 19:34 ColeCole 1,5031 gold badge11 silver badges20 bronze badges 1- awesome. I've been out of this for a year and need to get back up to speed... thanks to both answerers here. – Cole Commented Oct 7, 2012 at 18:30
2 Answers
Reset to default 12It 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.
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('&');