In JavaScript almost everything that has a structure inherits from Object.
In JavaScript objects can have any property.
With this statements you can see that a function is an object actually, so you can set all the properties that you want to it, just like a simple {} (with small limitations, as functions have another set of properties that plain objects don't have).
With this snippet you can check that functions inherit from Object.
function myFunc() {
// empty! :-)
}
console.log("Func inherits from Object:", myFunc instanceof Object);
console.log("Array inherits from Object:", [] instanceof Object);
console.log("Object inherits from Object:", {} instanceof Object);
console.log("constant string inherits from Object:", "test" instanceof Object);
console.log(" * constant string DON'T inherits from Object but...");
console.log("String constructor inherits from Object:", String instanceof Object);
stuffrefers to thefunctionso its setting property of function. Useconsole.log(stuff)to understand better.