When we make an object like this
function myObject(){
Properties and methods here----
};
We write “function” keyword before name of object is it necessary? All objects are functions in real? Can we not write direct object name like this?
myObject(){
Properties and methods here----
};
No, not all objects are functions. (All functions are objects, though.)
Here,
objisn’t a function:Nor
dthere:The
functionkeyword is necessary in order to say “what follows is a function declaration or function expression.” It’s just part of the basic syntax of JavaScript.