There is a class

class Data { constructor(arg0, arg1) { this.arg0 = arg0; this.arg1 = arg1; } } 

How to represent an instance of this class new Data('arg0', 1) , in the form {arg0: 'arg0', arg1: 1} ?

  • Where exactly do you want to present it in this form? - Grundy
  • JSON.stringify(new Data('arg0', 1)); - Igor
  • @Grundy want const data = new Data('arg0', 1); was the same as const data = {arg0: 'arg0', arg1: 1); - i am so lame
  • @iamsolame, why do you think this is not the same? - Grundy
  • @Igor, this is understandable, but here it’s necessary to me as in the comments above, otherwise they will be fired by the devil: c - i am so lame

0