---
id: 5d661bc6e0696bdec46938d9
title: Part 27
challengeType: 0
isHidden: true
---
## Description
There is repetition in the `goTown` and `goStore` functions. When you have repetition in code, it is a sign that you need a new function.
Above the `goTown` function, create an empty function called `update`. This time the function should take a parameter named `location` so data can be passed into the function when it is called.
Here is an example of a function named `testFun` that accepts a parameter named `param`:
```js
function testFun(param) {
console.log(param);
}
```
## Instructions
## Tests
```yml
tests:
- text: See description above for instructions.
testString: assert(update.toString().match(/function update\(\s*location\)\s*\{\s*\}/));
```
## Challenge Seed
```html
```
### Before Test
```html
RPG - Dragon Repeller
XP: 0Health: 100Gold: 50
Monster Name: Health:
Welcome to Dragon Repeller. You must defeat the dragon that is preventing people from leaving the town. You are in the town square. Where do you want to go? Use the buttons above.