question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update title and text from rest parameter to rest property (or element)

See original GitHub issue

Describe 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

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-destructuring-assignment-with-the-rest-parameter-to-reassign-array-elements

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Nirajn2311commented, Dec 18, 2022

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

0reactions
rahulchopra-devcommented, Dec 19, 2022

Since @roygav has already committed changes, i can’t commit these changes right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rest parameters - JavaScript - MDN Web Docs
The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic ......
Read more >
REST API conventions - IBM
The basic create, read, update, delete operations are provided according to common REST API conventions. The top-level URL for an element type represents ......
Read more >
Working with lists and list items with REST | Microsoft Learn
Property Description Type GroupString Group identifier used for drill‑down feature. string Field Specifies a special field that should be included. string FilterData Data specified by a...
Read more >
Understanding REST Parameters | Documentation - SoapUI
Learn about REST Parameters and the different types of REST Parameters available to you in SoapUI: QUERY, HEADER, TEMPLATE, MATRIX and PLAIN.
Read more >
Understanding Destructuring, Rest Parameters, and Spread ...
Destructuring assignment is a syntax that allows you to assign object properties or array items as variables. This can greatly reduce the lines ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found