Objects are just data, with properties and methods.
Almost everything in JavaScript can be an Object:
Strings, Functions, Arrays.
person=new Object();
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";
Example:
<!DOCTYPE html>
<html>
<body>
<script>
var person=new Object();
person.firstname="John";
person.lastname="Doe";
person.age=50;
person.eyecolor="blue";
document.write(person.firstname + " is " +
person.age + " years
old.");
</script>
</body>
0 comments:
Post a Comment