---
id: 5d80d67021b11cdaa3f6b167
title: Part 116
challengeType: 0
isHidden: true
---
## Description
The conditional operator, also called the ternary operator, can be used as a one line if-else expression. The syntax is: `condition ? statement-if-true : statement-if-false;`.
Change the if-else expression from the last challenge to use the ternary operator instead. Here is an example:
```js
if (age >= 18) {
adultFunction();
} else {
kidFunction();
}
// The above if-else expression does the same thing as the following line
age >= 18 ? adultFunction() : kidFunction();
```
## Instructions
## Tests
```yml
tests:
- text: See description above for instructions.
testString: assert(attack.toString().match(/^\s*\}\s*else\s*if\s*\(\s*monsterHealth\s*\<\=\s*0\s*\)\s*\{\s*fighting\s*\=\=\=\s*2\s*\?\s*winGame\(\s*\)\s*\:\s*defeatMonster\(\s*\)\;?\s*\}/m));
```
## 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.