Breaking News
yeni film izle hd film seyret film izle

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.
 
Example
 
<html>

<head>

</head>

<body>

<script>

function road()

{

var car = new Object

car.name=”Lancer”

car.color=”Blue”

car.no=”MAH2059″

document.write(“<br> Car Name :”+car.name)

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

document.write(“<br> Car Number :”+car.no)

}

var mycar= new Object

mycar.details=road

mycar.details()

</script>

</body>

<html>

 
Output is:
Car Name :Lancer
Car Color :Blue
Car Number :MAH2059

Check Also

Functions Returning Values In Java Script

Function is a set of statements recognized by a name and can be used as …