2

Operation class creates an array like this, which has no class name before the array.

[operInputQuery[0].value, operInputQuery[1].value, operInputQuery[2].value]

'Table' class is purposed to be an unnamed class inheriting Operation's constructors.

It inherits properly, however, it creates the array with the unnecessary tag extends like this.

extends[operInputQuery[0].value, operInputQuery[1].value, operInputQuery[2].value, operInputQuery[3].value]

Yes, I do not want to create the array with 'extends' thing.

How can I make an unnamed extended class?

let Operation = class { //unamed class
  constructor(a, b, c) {
    this.a = operInputQuery[0].value;
    this.b = operInputQuery[1].value;
    this.c = operInputQuery[2].value;
  }
}

let Table = class extends Operation { //purposed to write an unnmaed extended class
  constructor(a, b, c, d){
    super(a, b, c);
    this.a;
    this.b;
    this.c;
    this.d = operInputQuery[3].value;
    }
};
Just Doo
  • 91
  • 8
  • 1
    Why are you passing in a, b, c within the constructor and assigning them values? Something seems to be off here. Also, what is operInputQuery? – aquaraga Aug 15 '20 at 06:33
  • The question is how to create unnamed extended class. – Just Doo Aug 15 '20 at 09:17
  • Classes can be anonymous, just like functions. How is the array being created? It doesn't make sense that it would somehow have the class named prepended to it even if the class had a name – Aluan Haddad Aug 15 '20 at 10:28

1 Answers1

0

operInputQuery is missing but i guess is an array of objects with value property, try this:

let operInputQuery = [{value: 1}, {value: 2}, {value: 3}, {value: 4}];

let Table = class { 
  constructor(a, b, c, d){
    this.a = a;
    this.b = b;
    this.c = c;
    this.d = d;
    }
};

let table = new Table(operInputQuery[0].value, operInputQuery[1].value, operInputQuery[2].value, operInputQuery[3].value);
console.log(table);
sonEtLumiere
  • 4,461
  • 3
  • 8
  • 35
  • operInputQuery is a function I build, and I do not rewrite the code on here because It requires the html part. Anyway, thank you for your effort, but you are suggesting to create another class 'Table' which I do not want. – Just Doo Aug 15 '20 at 09:11