Learn Functional Programming by Building a Spreadsheet - Step 105

Tell us what’s happening:

emptystring: (quotes) => quotes

Don;t know what I’m doing wrong

Your code so far

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

/* 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()],
  emptystring:  (quotes = "") => quotes 
  
}

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 105

You need actual empty string as a key, not the word emptystring

“” : (str) => str Doesn’t work.
Error message reads as follows:

SyntaxError: unknown: Unexpected token, expected “,” (44:2)

[ReferenceError: Can’t find variable: spreadsheetFunctions]
[ReferenceError: Can’t find variable: spreadsheetFunctions]
[ReferenceError: Can’t find variable: spreadsheetFunctions]

I figured it out adding the quotes.
My code:
MODERATOR Solution removed

1 Like

Hi @dreyes61

I’m glad you found a solution.
I removed the solution from your post so as not to spoil the learning experience for other Campers.

Happy coding

1 Like