If I do something like this it seems to work:
function a() { ... }
a.desc = "Description of a";
But can I break anything by doing that? Is there a better way?
If I do something like this it seems to work:
function a() { ... }
a.desc = "Description of a";
But can I break anything by doing that? Is there a better way?
From MDN:
In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.
Since functions are first-class objects, there is no way of breaking down anything by adding properties to them.