Is it possible to make an object callable by implementing either call
or apply
on it, or in some other way? E.g.:
var obj = {};
obj
Others have provided the current answer ("no") and some workarounds. As far as first-class support in the future, I suggested this very thing to the es-discuss mailing list. The idea did not get very far that time around, but perhaps some additional interest would help get the idea moving again.
https://esdiscuss.org/topic/proposal-default-object-method