Learn Functional Programming by Building a Spreadsheet - Step 104

Tell us what’s happening:

I have been trying this step for ages now and have come up with the following which works on codepen but not here. Can someone please tell me why this is not passing? Cheers.

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: ([x, y]) => Math.floor(Math.random() * y + x),
  range: nums => range(...nums),
  nodupes: nums => {
    for (let i = 0; i < nums.length; i++) {
  for (let j = 0; j < nums.length; j++) {
    if (nums[i] === nums[j] && i !== j) {
      nums.splice(j, 1);
    }
  }
  }
  },
}

// User Editable Region

Your browser information:

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

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 104

Welcome to the forum @Bangas

console.log(spreadsheetFunctions.nodupes([2, 1, 2, 5, 3, 2, 7]));
// undefined

Try returning nums

Happy coding

1 Like

Such a simple oversight. Got it. Thanks.

1 Like