How to call a method when initializing the object?

I have a function constructor. When it is invoked through the new starts sub execute function. I decided to rewrite the constructor in the form class, but are faced with the problem of a function call when initializing the class.

function Prop () {
 function request () {
 // ...
}

 void function execute () {
 // ...
}

 return request
}
April 3rd 20 at 18:24
1 answer
April 3rd 20 at 18:26
Solution
class Prop {
 constructor() {
 // here your code from "execute"
}
}

Find more questions by tags JavaScript