JavaScript syntax: Difference between revisions

Content deleted Content added
m Variables: Wikified the first instance of ES6
GreenC bot (talk | contribs)
Reformat 2 archive links. Wayback Medic 2.5
Line 987:
Rest parameters are similar to Javascript's <tt>arguments</tt> object, which is an array-like object that contains all of the parameters (named and unnamed) in the current function call. Unlike <tt>arguments</tt>, however, rest parameters are true <tt>Array</tt> objects, so methods such as <tt>.slice()</tt> and <tt>.sort()</tt> can be used on them directly.
 
The <tt>...</tt> operator can only be used with <tt>Array</tt> objects. (However, there is a proposal to extend it to <tt>Object</tt>s in a future ECMAScript standard.<ref>{{cite web|url=https://sebmarkbage.github.io/ecmascript-rest-spread/ |archive-url=https://web.archive.org/web/20160809104217/https://sebmarkbage.github.io/ecmascript-rest-spread/ |url-status=dead |archive-date=2016-08-09 | title=Ecmascript}}</ref>)
 
===Comparison===