mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix(curriculum): unclear messages in step 54 of statistic calculator (#54441)
This commit is contained in:
parent
ef30ec4363
commit
2c8ada2ce9
@ -7,7 +7,22 @@ dashedName: step-54
|
||||
|
||||
# --description--
|
||||
|
||||
To calculate a root exponent, such as $\sqrt[n]{x}$, you can use an inverted exponent $x^{1/n}$.
|
||||
To calculate a root exponent, such as $\sqrt[n]{x}$, you can use an inverted exponent $x^{1/n}$. JavaScript has a built-in `Math.pow()` function that can be used to calculate exponents.
|
||||
|
||||
Here is the basic syntax for the `Math.pow()` function:
|
||||
|
||||
```js
|
||||
Math.pow(base, exponent);
|
||||
```
|
||||
|
||||
Here is an example of how to calculate the square root of `4`:
|
||||
|
||||
```js
|
||||
const base = 4;
|
||||
const exponent = 0.5;
|
||||
// returns 2
|
||||
Math.pow(base, exponent);
|
||||
```
|
||||
|
||||
Declare a `standardDeviation` variable, and use the `Math.pow()` function to assign it the value of $variance^{1/2}$.
|
||||
|
||||
@ -25,13 +40,7 @@ Your `standardDeviation` variable should use the `Math.pow()` function.
|
||||
assert.match(getStandardDeviation.toString(), /standardDeviation\s*=\s*Math\.pow\(/);
|
||||
```
|
||||
|
||||
Your `standardDeviation` variable should use the `variance` variable.
|
||||
|
||||
```js
|
||||
assert.match(getStandardDeviation.toString(), /standardDeviation\s*=\s*Math\.pow\(\s*variance\s*,/);
|
||||
```
|
||||
|
||||
Your `standardDeviation` variable should use the `1/2` exponent.
|
||||
Your `Math.pow()` function should have a base of `variance` and an exponent of `1/2`.
|
||||
|
||||
```js
|
||||
assert.match(getStandardDeviation.toString(), /standardDeviation\s*=\s*Math\.pow\(\s*variance\s*,\s*1\s*\/\s*2\s*\)/);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user