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.

argument vs parameter unclear usage of words

See original GitHub issue

Describe your problem and how to reproduce it:

The usage of the word “argument” ist unclear to me. The title of this challenge uses the word “parameter”.

Then the instructions state: “If an arrow function has a single argument, the parentheses enclosing the argument may be omitted.”

But the following snippet cited from the instructions shows the parameter “item” without parentheses:

// the same function, without the argument [sic] parentheses
const doubler = item => item * 2;

The functions are never invoked with an argument in the examples.

As I understand it the sentence should say: “If an arrow function has a single parameter, the parentheses enclosing the parameter may be omitted.”

Add a Link to the page with the problem: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters

or,

https://github.com/freeCodeCamp/freeCodeCamp/blob/master/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/write-arrow-functions-with-parameters.md

Tell us about your browser and operating system:

  • Browser Name:
  • Browser Version:
  • Operating System:

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ShaunSHamiltoncommented, Oct 30, 2020

I would go for:


Just like a regular function, you can pass arguments into an arrow function.

// doubles input value and returns it
const doubler = (item) => item * 2;
doubler(4); // returns 8

If an arrow function has a single parameter, the parentheses enclosing the parameter may be omitted.

// the same function, without the parameter parentheses
const doubler = item => item * 2;

It is possible to pass more than one argument into an arrow function.

// multiplies the first input value by the second and returns it
const multiplier = (item, multi) => item * multi;
multiplier(4, 2); // returns 8

1reaction
ojeytonwilliamscommented, Oct 30, 2020

If an arrow function has a single argument, the parentheses enclosing the argument may be omitted.

// the same function, without the argument parentheses const doubler = item => item * 2;

These are the ones that should be changed, I think. In fact, we could use

// the same function, without the parentheses const doubler = item => item * 2;

instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the difference between an argument and a parameter?
Generally speaking, the terms parameter and argument are used interchangeably to mean information that is passed into a function.
Read more >
Parameters and Arguments - Lingo in a Nutshell [Book] - O'Reilly
The words parameters and arguments are often used interchangeably to indicate inputs that are passed to a function on which it can operate....
Read more >
Parameter vs argument - Medium
The parameter is a special kind of variable declared in the function signature. It is a placeholder that is used to access function...
Read more >
Programmer dictionary: Parameter vs Argument, Type ...
Parameter and argument are often confused, but they are totally different concepts. Let's discuss what they are and what are the differences.
Read more >
Four Types of Parameters and Two Types of Arguments in ...
Arguments are the actual values that were passed to the function when we call it. In other words, an argument could be an...
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