Learn Functional Programming by Building a Spreadsheet - Step 105

Tell us what’s happening:

Finally, to handle potential edge cases, add an empty string property (you will need to use quotes) which is a function that takes a single argument and returns that argument.
const spreadsheetFunctions = {

random: ([x, y]) => Math.floor(Math.random() * y + x),
range: nums => range(…nums),
nodupes: nums => […new Set(nums).values(),
“”: () => (“”),
}
i cannot pass the argument. what is wrong in here? please help.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const spreadsheetFunctions = {
  
  sum,
  average,
  median,
  even: nums => nums.filter(isEven),
  someeven: nums => nums.some(isEven),
  everyeven: nums => nums.every(isEven),
  firsttwo: nums => nums.slice(0, 2),
  lasttwo: nums => nums.slice(-2),
  has2: nums => nums.includes(2),
  increment: nums => nums.map(num => num + 1),
  random: ([x, y]) => Math.floor(Math.random() * y + x),
  range: nums => range(...nums),
  nodupes: nums => [...new Set(nums).values(),
  "": () => (""),
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 105

you have not given any parameter to your function so you can’t return that, please add a parameter to your function

This is your code:


Accoring to the instruction, what we need to define "" here is:

a function that takes a single argument and returns that argument.


First,

() =>("")

isn’t the correct syntax for a function.

The correct syntax for a function that takes a single argument should be:

num => {#enter your code here}

Second,

Inside the function, you should:

returns the argument

It sounds like there’s a missing parameter in your function that needs to be added for it to work properly.

I still don’t get it, can you please write the code. so that i can understand.

what code have you tried? please post your updated code

According to the instruction “takes a single argument and returns that argument”
An argument is the actual value that is passed to the function when it is called, so you need an argument for the function.

Your code wrote () which is missing an argument.

"": () => ("")

By the way… It seems the empty string property need to write at the first line of the function. Actually I think the order in object which doesn’t matter, but write it at the first line would be a good habit that improve the code readability :smiley:

I also was struggling about this task as well, I hope it can help you :smiley:

Happy Coding~~