I want to make an object that has properties but can also be called. Sort of like the toString property that returns a string that represents the object when it’s used as a string.
something that works like this:
o = {
prop: 2
toFunction: function(a) {
return a;
}
}
o('foo'); // returns foo
o.prop; // returns 2
Function is an object in JavaScript so you can do:
and so