var el1,el2 = [1,2] why not?
hemanth.hm at gmail.com
Wed Jul 4 10:31:45 PDT 2012
var a,b = 1; sets b to 1 and a is undefined, this is more C like semantics.
Where as a,b = b,a is more pythonis; Well then a,b=[1,2] should
make sense ?
/me also agrees to var[a,b] = foo;
On Wed, Jul 4, 2012 at 10:47 PM, Oliver Hunt <oliver at apple.com> wrote:
> 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;
> var a;
> var b = foo;
> We're working on introducing destructuring assignment so you'll be able to
> var [a, b] = foo;
> which is what you want, but we're not quite there yet.
> 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('&')
> ["foo=bar", "hello=world"]
> 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 <http://www.h3manth.com/>
> *-- Hemanth HM *
> es-discuss mailing list
> es-discuss at mozilla.org
*'I am what I am because of who we all are'*
*-- Hemanth HM *
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss