You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, let [a, ...b,] = iter or function f(a, ...b,) {} are syntax error.
As I understand, the intention of trailing comma is to allow move element easily when editing the code, especially in the code format like:
functionf(a,b,c,){}
it's easy to adjust the order of the whole line.
The rest element must be the last one, so there is no need to support trailing comma after rest element. It's actually protect programmers from appending elements after rest element.
But as this proposal allow a rest element be in any position, we should always allow trailing comma for consistency.
Currently,
let [a, ...b,] = iter
orfunction f(a, ...b,) {}
are syntax error.As I understand, the intention of trailing comma is to allow move element easily when editing the code, especially in the code format like:
it's easy to adjust the order of the whole line.
The rest element must be the last one, so there is no need to support trailing comma after rest element. It's actually protect programmers from appending elements after rest element.
But as this proposal allow a rest element be in any position, we should always allow trailing comma for consistency.
(Similar issue of other languages: python/cpython#53478 )
The text was updated successfully, but these errors were encountered: