> 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/character-acces/simulation-example.md).

# Simulation Example

Here is how the previous code might be rewritten in the context of a simulation game:

```javascript
let playerName = 'John';

// Use square bracket notation to access the second character (i.e. "o")
if (playerName[1] === 'o') {
  console.log('The second letter of your name is "o"');
} else {
  console.log('The second letter of your name is not "o"');
}

// Use square bracket notation to access the last character (i.e. "n")
if (playerName[playerName.length - 1] === 'n') {
  console.log('The last letter of your name is "n"');
} else {
  console.log('The last letter of your name is not "n"');
}
```

This code would output:

```javascript
The second letter of your name is "o"
The last letter of your name is "n"
```
