class AClass{
someValue=0;
value(){return this.someValue;}
}
let inst=new AClass;
if ( inst ){ // I want this to invoke inst.value() actually
.....
}
I am looking for a way to set up a class so its instances can be invoked as a function, kind of a "default function". Is that possible in js?
Edit: An alternative:
if ( inst() ){
....
}