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

Tell us what’s happening:

why is this wrong? is it because I am using a brave browser or was it my settings? or was it my code?

Your code so far

const getStandardDeviation = (array) => {
const variance = getVariance(array);
let standardDeviation = Math.pow($variance^{1/2}$)
}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

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

What error are you getting?

SyntaxError: unknown: Unexpected token (45:47)

43 | const getStandardDeviation = (array) => {
44 | const variance = getVariance(array);

45 | let standardDeviation = Math.pow($variance^{1/2}$)
| ^
46 | }

This error please help

I don’t know if its my settings or my code but the code was not accepted and when I look at the console it points at the backslash or division operator of the “1/2”

This is not inside a literal so you don’t need the $ or {} - but the 1/2 should be in ()

2 Likes

I feel ashamed thank you!

1 Like

Idk how you solve it since the solution didn’t exactly address the issue, Imma just leave this reply for future reference.

This is the correct syntax to get the base raised to a power:

Math.pow(base, exponent);

So with that in mind and looking again at the instructions for this step:

Declare a standardDeviation variable, and use the Math.pow() function to assign it the value of $variance^{1/2}$.

Just take the variance variable as the base, and 1/2 as the exponent.

4 Likes

Thanks for this, tbh this should be what the actual instruction for this step says.

Thank you so much, this was very helpful!,…

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.