Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否有一个相当于解压序列的javascript,比如python?
a, b = (1, 2)
[a, b] = [1, 2]
更新:
浏览器兼容性矩阵:
没有。JavaScript 没有这样的语法糖。
一个对象不能包含对整数的引用,只能包含它的值。所以我看不出有什么方法可以做你在javascript中提出的要求。