Learn Functional Programming by Building a Spreadsheet - Step 101

Tell us what’s happening:

Im not really sure what its asking for. I did the best I could and looked for other solutions.

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(nums => nums === isEven(nums)),
  firsttwo: nums => nums.slice(0, 2),
  lasttwo: nums => nums.slice(-2),
  has2: nums => nums.includes(2),
  increment: nums => nums.map(num => num + 1),
}

// User Editable Region

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/15.5 Safari/605.1.15

Challenge Information:

Learn Functional Programming by Building a Spreadsheet - Step 101

The instruction asked us to add an everyeven property, and this property is an arrow function, just like the has2 or increment property you did before in the previous step:

But in the body of the arrow function,
instead of using nums.includes(2) to check if the array has the number 2 or not, like in the has2 property,
we need to use the .every() method to check whether all array elements are even.

About how to use .every() method, you can check the given example in the instruction as a reference:

An example of a .every() method call to check if all elements in the array are uppercase letters:

const arr = ["A", "b", "C"];
arr.every(letter => letter === letter.toUpperCase());

To check a number is even or not, you can check if num % 2 is equal 0 or not.