Answer the question
In order to leave comments, you need to log in
What is the name of this kind of class in js?
Here is the class, and there is a return inside, I don't see this in the MDN documentation, but it somehow works.
const TestUtil = function() {
const testHandlers = [];
const _testHandlerInit = () => {
console.log('works')
}
return { /////// С вот таким return
init: function(settings) {
_testHandlerInit ();
},
avrukh: function() {
console.log('avg')
}
}
}
let util = new TestUtil();
util.init() /// 'works'
util._testHandlerInit() /// Ошибка. Может return показывает к каким методам есть доступ а остальные вспомогальные?
Answer the question
In order to leave comments, you need to log in
Well, initially in js, a class is just a function that returns an object. By default, this is the new this, but you can return anything to confuse the enemy.)
No name, just a controversial feature of the language.
I'm not sure, but it seems that you mean a class with a constructor
You return a new object with the following signature:
{
init: function,
avrukh: function
}
{
testHandlers: testHandlers,
init: function,
avrukh: function
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question