Freecodecamp: argument vs parameter unclear usage of words

Created on 30 Oct 2020  路  5Comments  路  Source: freeCodeCamp/freeCodeCamp


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):

first timers only learn

All 5 comments

Hello~!

I agree that the verbiage is wrong here. Argument should probably be replaced with parameter in the examples and text, with the exception of the top line (which, at a quick glance, is the only correct use of argument):

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

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.

I like that approach. Think this could be opened up to first timers?

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

Sure, that works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaibsharma picture vaibsharma  路  3Comments

robwelan picture robwelan  路  3Comments

kokushozero picture kokushozero  路  3Comments

ar5had picture ar5had  路  3Comments

SaintPeter picture SaintPeter  路  3Comments