Learn Advanced Array Methods by Building a Statistics Calculator - Step 47

Tell us what’s happening:

I am not sure what I am doing wrong. I have been to google, through previous lessons, MDN, etc. This exercise seems pretty straightforward but I’m getting an error saying :

// running tests
Your map callback should return the value of el squared.
Your map callback should use the ** operator.
// tests completed
I’m pretty sure that’s what I’ve done here:

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const getVariance = (array) => {
  const mean = getMean(array);
  const differences = array.map(
    el => el - mean
  );
  const squaredDifferences = differences.map(el => el ** el);
}

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

Challenge Information:

Learn Advanced Array Methods by Building a Statistics Calculator - Step 47

el ** el is not equal to el²

you have el to the power of el. That’s not calculating the square

( el => el * el )

Results in the same error. I have tried many different approaches.

el * el is better, as that is el muliplied to itself, and it is what el squared is, but you are not using the ** operator
can you write el squared ( el²) using the ** operator?

Thank you so much! I got it!! That helped!