In an assignment, I was given the following task:
fun4(): must return an object that can be called as a function. This object should also have a 'k' property with a null value (so fun4()() should perform some action).
The first part of the question is clear and easy to understand. However, the second part is where I am struggling. How can I create a JavaScript object that can be both invoked and accessed statically?
To put it simply: Is it possible to create an object that behaves like this?
> let o = CustomObject;
> o.k
< null
> o()
< //Some value returned here from the function
Any help or guidance on this would be greatly appreciated!