Learn Functional Programming by Building a Spreadsheet - Step 102

Tell us what’s happening:

I am not sure what needs to be done over here to get a random number between the firsttwo property

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: nums => Math.floor(Math.random(nums.between(firsttwo)),
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 102

They want you to create a function (assigned to the random property) that takes two numbers from an array (so the input is a destructured array) and then uses these two numbers to calculate a random number between them. (Where the randomly generated number lies in the range: inclusive of the smaller value and exclusive of the sum of the two inputs)

1 Like