0 votes
in JavaScript by
Can we define properties for functions?

1 Answer

0 votes
by

Yes, We can define properties for functions because functions are also objects.

fn = function (x) {
  //Function code goes here
};

fn.name = "John";

fn.profile = function (y) {
  //Profile code goes here
};
...