Question: I am an Italian guy who is learning javascript..
I am following a course to create a text based RPG but I am stucked with this error: Uncaught ReferenceError: Hero is not defined

Where Hero is a class that extends a main class.

It's a localhost project with 2 .js file and one html that link them togheter 

**THIS IS IN THE FILE WHERE I CREATE THE STORY**

```
const eroePrincipale = new Hero (nome, 10, sesso, razza, ruoloPersonaggio);
console.log(eroePrincipale);

```

**THIS IS IN THE FILE WHERE I CREATE CHARACTERS**

```
class PersonaggioBase {
constructor(nome, salute){
    this.nome = nome;
    this.saluteMax = salute;
    this.saluteCorrente = salute;
    this.attributi = {
        attacco: 10,
        furtività: 10,
        persuasione: 10
    };
    this.abilità = {
        attacco: 0,
        furtività: 0,
        persuasione: 0
    };
  };
};

class Hero extends PersonaggioBase {
constructor(nome, salute, sesso, razza, ruolo){
    super(nome, salute);
    this.sesso = sesso;
    this.razza = razza;
    this.ruoloPersonaggio = ruolo;
    this.immobilizzato = false;
    this.armaEquipaggiata = {
        nome : 'Nessuna',
        dannoMinimo: null,
        dannoMassimo: null
    };
    this.armaturaEquipaggiata = {
        nome: 'Nessuna',
        attributiBonus: null
    };
  };
};

```

It should log out me the Hero with all the currect stats

Answer: 
Sometimes, the easiest thing to do is to get the program to explain itself:

```c
#include <stdio.h>
#include <stdlib.h>

int main(void){
    int a = 4;
    int b = 2;
    int result = 0;

    for(int count = 0; count != b; count++) {
        printf("a = %3d, b = %3d, count = %3d, result = %3d\n", a, b, count, result);
        result = result + a;
        printf("a = %3d, b = %3d, count = %3d, result = %3d\n", a, b, count, result);
    }
    printf("a = %3d, b = %3d\n", a, b);

    printf("a times b is %i\n", result);

    return 0;
}

```

**Output**

```none
a =   4, b =   2, count =   0, result =   0
a =   4, b =   2, count =   0, result =   4
a =   4, b =   2, count =   1, result =   4
a =   4, b =   2, count =   1, result =   8
a =   4, b =   2
a times b is 8

```

As you can see, `b` does not change. `count` changes and the loop is exited when `count` is equal to `b`.
The loop runs only two times we can dry run the loop like that:
Initial values for variables: -> a = 4, b = 2, count = 0 and result = 0

```
loop first run -> 
count = 0
count != 2 -> that is ->  0 != 2  => true
result = result + a   ->  0 + 4  = 4

second run ->
count = 1 
count != b -> that is ->  1 != 2  => true
result = result + a   ->  4 + 4 = 8

third run ->
count = 2
count != b -> that is ->  2 != 2 => false 
stop loop. 
And the final resultent values are as follow: a= 4, b= 2 , count = 2 and result = 8

```