jeudi 18 février 2021

Console.log from a class' function

I want to test if my function inside my class returns the given sentence. But if I try to test using console.log, it returns ReferenceError: rev is not defined. What am I doing wrong?

class store {
    constructor(revenue, workers) {
        this.revenue = revenue;
        this.workers = workers;
    }
}

class storeManager extends store {
    constructor(name) {
        super(revenue, workers);
        this.name = name;
    }

    rev() {
        return "The stores revenue is" + this.revenue;
    }
  
    hiredWorkers() {
        return "The store has" + this.revenue + "workers";
    }
};

console.log(rev())

I'm a fairly new programmer, so bear with me if this is a stupid question.

Aucun commentaire:

Enregistrer un commentaire