Functions also behaves like objects In JavaScript

In Javascript functions also behave like objects. In JavaScript we can use function like an object. As an object is collection of variables and methods. The function also contains variables. We can access a function variables like object property by using dot(.) operator, as we access an object property.





function road()


var car = new Object”Lancer”


document.write(“<br> Car Name :”

document.write(“<br> Car Color :”+car.color)

document.write(“<br> Car Number :”


var mycar= new Object






Output is:
Car Name :Lancer
Car Color :Blue
Car Number :MAH2059
Scroll to Top