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~~

HI, I’m stuck here and it gives me headaches somebody help pls, I’ve tried “”: (arg) => arg, nothing…

hey there @cristianmorar.m , please open your own topic

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Ask for Help button located on the challenge (it looks like a question mark). This button only appears if you have tried to submit an answer at least three times.

The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.