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`.
it will be executed 2 times
===========================

count= 0 ==> result=0+4   

and count =1 ==> result=4+4 ==> result=8  

**when it will reach count= 2 the 2!=2 part will be false and we will exit the for loop**