I want to create a variable inside a javascript class without the necessity to call it by a variable with the constructor.
for example, we have a class A that takes in 2 inputs (a and b). a and b are summed and the result is appended to an array arr. Where´s the best place to declare the array?
class A {
constructor(a,b) {
this.a = a;
this.b = b;};
do_something(this.a, this.b) {
let c = this.a + this.b;
arr.append(c);
return arr;}
};
where should i initialize arr without having it to be called form the outside ?