Reputation: 11561
Is there a javascript equivalent to unpack sequences like in python?
a, b = (1, 2)
Upvotes: 20
Views: 7990
Reputation: 33994
[a, b] = [1, 2]
Update:
Browser compatibility matrix:
Upvotes: 19
Reputation: 26971
An object cannot contain a reference to an integer, only its value. So I can't see any way to do what you ask in javascript.
Upvotes: -4