This doesn't do what you want as assignments in initialisers are optional.
This has the semantic effect of meaning that there is no difference between
var a, b = foo;
and
var a;
var b = foo;
We're working on introducing destructuring assignment so you'll be able to do
var [a, b] = foo;
which is what you want, but we're not quite there yet.
--Oliver
On Jul 4, 2012, at 10:08 AM, Hemanth H.M wrote:
> Hello Hackers,
>
> This might be silly, but let the code speak :
>
> var param1,param2 = window.location.search.replace('?','').split('&')
> undefined
> param1
> undefined
> param2
> ["foo=bar", "hello=world"]
> a=1
> 1
> b=2
> 2
> a,b=b,a
> 1
> a
> 1
> b
> 2
>
> Why not param1 be equal to "foo=bar" and param2 be equal to "hello=world"?
>
>
> --
> 'I am what I am because of who we all are'
> h3manth.com
> -- Hemanth HM
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss