FrontendDeveloper.in

JavaScript question detail

Can we define properties for functions

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
};
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399