> 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/default-export/strategy-adventure-game-example.md).

# Strategy Adventure Game Example

Here is an example of using the default export in a strategy adventure game:

```javascript
// enemy.js

export default class Enemy {
  constructor(name, level, attack, defense) {
    this.name = name;
    this.level = level;
    this.attack = attack;
    this.defense = defense;
  }
}

// game.js

import Enemy from './enemy';

class Game {
  start() {
    const enemy = new Enemy('Orc', 1, 5, 3);
    console.log(`A level ${enemy.level} ${enemy.name} appeared!`);
  }
}

const game = new Game();
game.start();

```

Sure! Here is an example of using the default export in a strategy adventure game:

```javascript
Copy code// enemy.js

export default class Enemy {
  constructor(name, level, attack, defense) {
    this.name = name;
    this.level = level;
    this.attack = attack;
    this.defense = defense;
  }
}

// game.js

import Enemy from './enemy';

class Game {
  start() {
    const enemy = new Enemy('Orc', 1, 5, 3);
    console.log(`A level ${enemy.level} ${enemy.name} appeared!`);
  }
}

const game = new Game();
game.start();
```

In this example, the `Enemy` class is defined in the `enemy.js` file and then exported as the default export. It is then imported into the `game.js` file and used to create a new enemy object. When the `start()` method is called, a message is logged to the console indicating that a level 1 Orc has appeared.
