No, but it seems ...
This can be done using valueOf
var foo = function() { console.log("From Function"); return "Function"; }; foo.valueOf = function() { return "Variable"; }; alert( 'Output is: ' + foo() ) alert( 'Output is: ' + foo )
This cannot be done using JavaScript, because an element in an object can be two different objects.
If you want a property to be a function and an object, these are different
source share