TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

JavaScript proposal: destructuring assignment

26 点作者 fogus大约 13 年前

8 条评论

samth大约 13 年前
That link is to a really old ES4 discussion. The proposal for ES6 is at <a href="http://wiki.ecmascript.org/doku.php?id=harmony:destructuring" rel="nofollow">http://wiki.ecmascript.org/doku.php?id=harmony:destructuring</a> and has now been incorporated in the draft ES6 spec.
wingo大约 13 年前
A form of this will probably be in ES6:<p><a href="http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11.13.1" rel="nofollow">http://people.mozilla.org/~jorendorff/es6-draft.html#sec-11....</a>
yoklov大约 13 年前
CoffeeScript implements this syntax, and, of course, it's extremely awesome.<p><a href="http://coffeescript.org/#destructuring" rel="nofollow">http://coffeescript.org/#destructuring</a>
fmstephe大约 13 年前
I think this is a great proposal. I would be very happy to see destructuring assignment in JS. In every other language I've used that supports this (Erlang, Clojure) it is a big win.
VMG大约 13 年前
This would be extremely handy. At the moment I'm sometimes even writing<p><pre><code> (function (a, b, c) {/**/}).apply(null, packed); </code></pre> to emulate destructuring.
Roboprog大约 13 年前
Cool, if it gets widespread implementation.<p>Had to read a ways down to see an example to confirm, in simple terms, that this would mean you could make function calls such as:<p>( a, b, c) = f();<p>like you would in Perl / Python / Ruby. (not so good at decoding BNF while I'm sipping my first cup of coffee in the morning...)
Zecc大约 13 年前
This is something that's been in Firefox's JS way back since FF 2.0.<p><a href="https://developer.mozilla.org/en/New_in_JavaScript_1.7" rel="nofollow">https://developer.mozilla.org/en/New_in_JavaScript_1.7</a>
antinitro大约 13 年前
Seems like half of the comments are from 6 years ago, am I missing something?
评论 #3733935 未加载