Learn Functional Programming by Building a Spreadsheet - Step 103

Tell us what’s happening:

  1. Your spreadsheetFunctions object should have a range property.
  2. Your range property should be a function.
  3. Your range function should return an array of consecutive numbers from the first number in the argument to the second number in the argument.

Your code so far

range: nums => range(nums[1], nums[2]),

i really don’t understand this one, can someone enlightened me?

<!-- 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[1], nums[2]),

// 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/132.0.0.0 Safari/537.36

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 103

Hi. Remember zero based numbering when accessing figures from an array. Need to tweak your indexes.

you mean like this?

range: nums => range(nums[0], nums[1]),

but it still not pass

1 Like

That worked for me? Do you need a hard refresh? Perhaps post all your code as there may be something else.
Do you have the closing bracket after the function code?

1 Like

Hey there,
You might have removed something unintentionally, so reset your code and add the range property again.
Hope this helps!

1 Like