0

I mean I tried to make a function that can have a function has a property, but a Function is not an Object ? So I am confused, I would like to resolve this :

var destroy = require('alphaDestroyerBeeBop');

const penny = destroy(); // this explodes the computer
const tissue = destroy.graphicCard(); // this Just explodes the graphic card

destroy() is a function but destroy in destroy.graphicCard() looks like an object. Like an hybrid object.

Is there a way to do that in JavaScript ?

vdegenne
  • 12,272
  • 14
  • 80
  • 106
  • 3
    yup. `function foo () {}; foo.bar = 5;` bar could just as well be a function – Kevin B Apr 04 '18 at 05:18
  • 1
    _"but a Function is not an Object"_ - It is -> [oop - How is almost everything in Javascript an object?](https://stackoverflow.com/questions/9108925/how-is-almost-everything-in-javascript-an-object#9110389) – Andreas Apr 04 '18 at 05:19

0 Answers0