Learn Functional Programming by Building a Spreadsheet - Step 102

Tell us what’s happening:

Hey guys, Im trying to create a random whole number in the range of. the first two numbers in the array and Im messing somewhere. Would you mind taking a look at my code

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.slice(0, 2).sort((a, b) => a - b)))
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 102

You should check the console to see if there are error messages being logged.
Also make sure you look up how to use the random function online (you can google something like: math.random MDN) to get results.