User Rating: 2 / 5

Star ActiveStar ActiveStar InactiveStar InactiveStar Inactive
 

In JavaScript , it will attempt to assume that everything is an object (Objects) to do it. This is for ease of programming objects (Objects) , but it is composed of two main elements .

 

1. Properties are values associated with objects.

Object is assumed that the shirt was too Properties shirt brand, weight, color, price.

Suppose you Propeties Object as it 's you, it's like sex, age , weight and height .

Example:

<html>
<body>
<script>
var shirt=new Object();
shirt.name="Billabong";
shirt.color="blue";
shirt.price="60 USD"; 
document.write("The brand is - " +shirt.name +"<br> The Color is - " + shirt.color + "<br>Price - " +shirt.price);
</script>
</body>
</html>

This is the result:

 

2. Methods are actions that objects can perform.

Radio. Play () Play the tape. 

Radio. Stop () stops 

Door. Lock () Locks 

Cars. Brake () stop. 

Example:

<html> 
<body> 
<script> 
var str = new String ("MindPHP"); 
document.write (str.link ("http://www.Mindphp.com")); 
</script> 
</body> 
</html>

This is the result:

 

 

Next