Change "rest operator" to say "rest parameter" in challenges and guide (#35496)
* change es6 challenges rest operator to param * fix rest parameter typos * change rest operator to parameter in guide * fix casing * change rest operator to rest parameter in guide * change rest operator to rest parameter in curriculum * remove extra whitespace * remove whitespaces * remove whitespace * fix: removed arabic file * fix: removed chinese file
This commit is contained in:
@@ -80,7 +80,7 @@ function Person(){
|
||||
|
||||
var p = new Person();
|
||||
```
|
||||
An arrow function does not have its own `arguments` object. For example, if you do not know the number of arguments passed to a function, instead of using `arguments` you can use the `rest` operator:
|
||||
An arrow function does not have its own `arguments` object. For example, if you do not know the number of arguments passed to a function, instead of using `arguments` you can use the `rest` parameter:
|
||||
```javascript
|
||||
const myFunc = (...n) => {
|
||||
console.log('The first argument is', n[0]);
|
||||
|
@@ -3,7 +3,7 @@ title: Rest Parameters
|
||||
---
|
||||
|
||||
## Rest Parameters
|
||||
In ES6, the rest paramter syntax `...` allows you to gather up an indefinite number of arguments into an array.
|
||||
In ES6, the rest parameter syntax `...` allows you to gather up an indefinite number of arguments into an array.
|
||||
|
||||
Even though they look the same, it does the opposite of the spread operator, which takes every item from an iterable and spreads them out into their individual values.
|
||||
|
||||
@@ -18,7 +18,7 @@ myFunc( 1, 2, 3, 4, 5); // [1,2,3,4,5]
|
||||
|
||||
```
|
||||
|
||||
You can prefix a function's last parameter with `...` when you want to do something with the initial paramters and then treat all of the remaining parameters differently.
|
||||
You can prefix a function's last parameter with `...` when you want to do something with the initial parameters and then treat all of the remaining parameters differently.
|
||||
|
||||
```js
|
||||
function convertCurrency(rate, fee, ...amounts) {
|
||||
|
@@ -18,9 +18,9 @@ console.log(oneArg.length); // 1
|
||||
|
||||
### ES2015 Syntax
|
||||
|
||||
ES2015, or ES6 as it is commonly called, introduced the rest operator and default function parameters. Both of these additions change the way the `length` property works.
|
||||
ES2015, or ES6 as it is commonly called, introduced the rest parameter and default function parameters. Both of these additions change the way the `length` property works.
|
||||
|
||||
If either the rest operator or default parameters are used in a function declaration the `length` property will only include the number of arguments before a rest operator or a default parameter.
|
||||
If either the rest parameter or default parameters are used in a function declaration the `length` property will only include the number of arguments before a rest parameter or a default parameter.
|
||||
|
||||
```javascript
|
||||
function withRest(...args) { }
|
||||
|
Reference in New Issue
Block a user