NaN
const x = new Calc
function Car (name){
this.name = name
}
Car.prototype.sound = function(){
console.log("vroom");
}
// class syntax
class Car {
constructor(name){
this.name = name;
}
sound(){
console.log("vroom");
}
}
constructor()
function but you arent instantiating the class, so shouldnt you use static
class field instead?
static
fields to the class, I think it'd be better for your use case:class Calc {
static sum;
static operatorMemory;
static reset() {
Calc.sum = undefined;
Calc.operatorMemory = undefined;
}
...