Java Objects
JavaScript is designed on a simple object-based paradigm. An object is a collection of properties, and a property is an association between a name (or key) and a value. A property's value can be a function, in which case the property is known as a method. In addition to objects that are predefined in the browser, you can define your own objects. This chapter describes how to use objects, properties, functions, and methods, and how to create your own object
Object OverView
Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life. The concept of objects in JavaScript can be understood with real life, tangible objects. In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup Objects and properties
A JavaScript object has properties associated with it. A property of an object can be explained as a variable that is attached to the object. Object properties are basically the same as ordinary JavaScript variables, except for the attachment to objects. The properties of an object define the characteristics of the object. You access the properties of an object with a simple dot-notation
Example
<html><head>
<title> Java Script </title>
</head>
<body>
<p id="historystaff"> </p>
<script>
//create Object
var historystaff=
{
fristname:"Vannak",
lastname:"Vannaro",
year:40;
//display object
document.getElementById("staff").innerHTML=historystaff.firstname + historystaff.lastname + "Years" + historystaff.year + "";
}
</body>
</html>
Please Watching My Video is Below
No comments:
Post a Comment