Javascript left-hand assignment
Wouldn’t it be great to do something like this in javascript:
function test(){
return ['first!', 'second!'];
}
[first, second] = test();
alert(first); // should say ‘first!’
alert(second); // should say ’second!’
Wouldn’t it be great to do something like this in javascript:
function test(){
return ['first!', 'second!'];
}
[first, second] = test();
alert(first); // should say ‘first!’
alert(second); // should say ’second!’