Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Usage of `...` (three-dots or dot-dot-dot) in functions [duplicate]

Tags:

r

ellipsis

Where can I find documentation on the usage of ... in functions? Examples would be useful.

like image 457
Brandon Bertelsen Avatar asked May 04 '11 22:05

Brandon Bertelsen


People also ask

What is the function of the three dots?

An ellipsis (plural: ellipses) is a punctuation mark consisting of three dots. Use an ellipsis when omitting a word, phrase, line, paragraph, or more from a quoted passage. Ellipses save space or remove material that is less relevant.

What is the use of 3 dots in JavaScript?

The three dots in JavaScript are the spread / rest operator. The spread syntax allows an expression to be expanded in places where multiple arguments are expected. The rest parameter syntax is used for functions with a variable number of arguments. The spread / rest operator for arrays was introduced in ES6.

What do 3 dots mean in Typescript?

The three dots are known as the spread operator from Typescript (also from ES7). The spread operator return all elements of an array.

What do three dots above and below code mean?

three dots in javascript. The spread syntax is a new addition to the set of operators in JavaScript ES6. It takes in an iterable (e.g an array) and expands it into individual elements. The spread syntax is commonly used to make shallow copies of JS objects.


1 Answers

The word used to describe ... is "ellipsis." Knowing this should make searching for information about the construct easier. For example, the first hit on Google is another question on this site: How to use R's ellipsis feature when writing your own function?

like image 179
John Zwinck Avatar answered Sep 22 '22 05:09

John Zwinck