I have seen this in a piece of JS code:
var {status, headers, body} = res;
What does it do?
nice method to set few variables at once from an object (open firebug and paste this to console)
var status=4;
var headers=4;
var body=4;
var res = {status:1, headers:2, body:3};
window.alert(status);
var {status, headers, body} = res;
window.alert(status);
i read something different from your expression here . this may help u
var { a:x, b:y } = { a:7, b:8 };
Print(x); // prints: 7
Print(y); // prints: 8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With