---
id: 699f52220de88c8091032076
title: Step 18
challengeType: 1
dashedName: step-18
---

# --description--

If you open up the console, the result is `NaN` because the second argument for the `exponent` was never provided. There are a couple of updates needed for this `raiseTo` function that will fix this. 

The first change is to return `base ** 2`.

In the next step, you will see how to handle the optional `exponent` parameter.

# --hints--

Your `raiseTo` function should return a number.

```js
assert.isNumber(raiseTo(4));
```

Your `raiseTo` function should return the value of `base` raised to the power of `2`.

```js
assert.strictEqual(raiseTo(4), 16);
assert.strictEqual(raiseTo(5), 25);
```

# --seed--

## --seed-contents--

```ts
function square(num: number) {
  return num * num;
}

const result = square(5);

console.log(result);

function getAverage(numbers: number[]): number {
  const sum = numbers.reduce((acc, n) => acc + n, 0);
  return sum / numbers.length;
}

const avgResult = getAverage([2, 14, 26, 8]);

console.log(avgResult);

--fcc-editable-region--
function raiseTo(base: number, exponent?: number): number {
  return base ** exponent;
}
--fcc-editable-region--

const raisedResult = raiseTo(3);
console.log(raisedResult);
```

```json
{
  "compilerOptions": {
    "noCheck": true
  }
}
```
