Update title and text from rest parameter to rest property (or element)
See original GitHub issueDescribe the Issue
A rest parameter would involve parameters.
The MDN article on rest parameter only has function parameter examples and it links to the function definition part of the specs. The only instance I can find of the words “rest parameter” in the specs is under the Parameter Lists section.
MDN calls it a rest property when ...rest
is used with a destructuring assignment.
The specs do seem to have two versions of it if I read it correctly, the AssignmentRestElement
used with arrays and the AssignmentRestProperty
used with objects.
13.15.5.2 Runtime Semantics: DestructuringAssignmentEvaluation
ObjectAssignmentPattern : { AssignmentPropertyList , AssignmentRestProperty }
ArrayAssignmentPattern : [ AssignmentElementList , Elision AssignmentRestElement ]
While “rest element” might be more correct with an array I don’t think using “rest property” for both arrays and objects as MDN does is the end of the world.
Affected Page
Your code
const [one, two, ...restElement] = [1, 2, 3, 4, 5];
const { name, age, ...restProperty } = {
name: 'John',
age: 30,
email: 'example@john.com',
address: 'Sesame Street',
};
Expected behavior
The correct technical definition should be used.
Screenshots
No response
System
- Device: [e.g. iPhone 6, Laptop]
- OS: [e.g. iOS 14, Windows 10, Ubuntu 20.04]
- Browser: [e.g. Chrome, Safari]
- Version: [e.g. 22]
Additional context
This PR https://github.com/freeCodeCamp/freeCodeCamp/pull/35496 changed it from rest operator to rest parameter.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top GitHub Comments
An issue with the help wanted or first timers only label is open for contribution. The first comprehensive PR created will be reviewed and merged.
If have not read the contributors docs then I would suggest reading that first
If you have any issues with contributing, be sure to join us on the contributors channel, or on the contributors sub-forum
Since @roygav has already committed changes, i can’t commit these changes right?