--- id: 5d661bc6e0696bdec46938d9 title: Part 27 challengeType: 0 dashedName: part-27 --- # --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); } ``` # --hints-- See description above for instructions. ```js assert(update.toString().match(/function update\(\s*location\)\s*\{\s*\}/)); ``` # --seed-- ## --before-user-code-- ```html RPG - Dragon Repeller
XP: 0 Health: 100 Gold: 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.
``` ## --after-user-code-- ```html ``` ## --seed-contents-- ```html ``` # --solutions-- ```html ```