Need help with Learn Functional Programming by Building a Spreadsheet Step 103

My code so far:

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()]
}
1 Like

this is missing a colon, a value, and a comma after

My code so far:

const spreadsheetFunctions = {
  "": {value: "", text: ""},
  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()]
}

What exactly do I have to do to this code that still does not pass?

1 Like

I am having the exact same problem. I have tried numerous functions on MDN including this snippet β€œβ€: () => (β€˜β€™),
that returns " " when I console.log(β€œβ€);
Used arrays, Object.key(), and read from countless sites. They seem to think the Object Property should be a word and then the condition. My brain broke. :slightly_smiling_face:

I am piggy backing this post because their are multiple posts seeking the same help β€œor a solution at this point”. Appreciate any assistance that can be provided.

I have read the previous forum post’s and this β€œlast step” has had me stuck for a couple of days.

@ilenia has just about given the solution away.

Use that advice in conjunction with how the other lines of code are structured.

Happy coding

Hi Teller,

Thanks for your reply but the advice of β€œthis is missing a colon, a value, and a comma after” is not helping because the value is the issue we seem to be struggling with.

When you say value, I think maybe that is where I am lost. What could it possibly be when referring to an empty string? I have tried :
β€œβ€: (β€œβ€,() => {(β€œβ€)}),
β€œβ€: (array) => [β€œβ€], ---- console.log(Object(β€œβ€));Returns > String { "" }
β€œβ€: β€œβ€, β€” console.log((β€˜β€™)); RETURNS β€œβ€
β€œβ€: (β€œβ€), β€” console.log(Object(β€˜β€™)); Returns > String { "" }
I am all out of ideas. Thanks

What value appears after each colon in the function?

This whole variable is simply an Object of spreadsheetFunctions made up of property names referencing functions, while some have keys (nums) acting as functions. To your point, anything inside of the () is a parameter or function, the latter requiring a definition and call back. This is probably more simple than I am making it. I feel like I am going to be kicking myself when I figure it out. Thanks again Teller for your guidance. I will try again tomorrow.

1 Like

The object property you are asked to add consists of an empty string as the key and a function as the value.

The function should accept an argument using a parameter and simpely return that parameter.

the value is an object here, when the request is a function that takes one parameter and returns that parameter. Please try to write such function

Thank you Teller, lasJorg, and ilenia…It took me a bit and as I suspected, I am kicking myself. Thanks for your guidance.

1 Like