> For the complete documentation index, see [llms.txt](https://demirels-organization.gitbook.io/javascript-tutorial/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://demirels-organization.gitbook.io/javascript-tutorial/converting-numbers-to-strings/fighting-game-example.md).

# Fighting Game Example

Imagine that the game allows players to select their characters' attack power before each match. The attack power is a numeric value that determines how much damage the character can inflict on their opponent.

To select their attack power, the player is presented with a form that includes a field for entering a number. The player types in their desired attack power (e.g. "50") and submits the form.

The game could then use the `parseInt()` function to convert the string value entered by the player into a number that can be used in the game logic.

Here is some example code that demonstrates how this might work:

```javascript
let attackPowerInput = '50';  // The player enters "50" into the form field
let attackPower = parseInt(attackPowerInput);  // Convert the string to a number

// Use the attack power in the game logic
if (attackPower > 75) {
  console.log('This character is very powerful!');
} else {
  console.log('This character is average in power.');
}
```

In this example, the player has entered "50" as their attack power. The `parseInt()` function converts this string to the number 50, which is then used in the game logic to determine the strength of the character.
