Learn web design and programming with our free video and text tutorials.

Web Designer? Design and market your own professional website with easy-to-use tools.

Javascript Objects Tutorial

Javascript is an object oriented programing (OOP) language.

An OOP is a programing language that is organized around objects. Objects have properties and methods.

Javascript uses periods (.) to seperate object names and property names. For example, an object called "Car", might have properties Car.new and Car.blue.

In large scripts, this allows you to create self-contained javascript objects, which allow you to reuse javascript code more often.

An object in javascript is an abstract container that is used to hold data. The data that is contained in the object can be a single number or a more complex data structure.

In javascript, you can create your own objects, or you can use predefined objects, such as "string", "date" and "array".


Each object has one or more properties. A property is a variable that is associated with that object.

In the javascript code example below, the length property of the string object is used to return the number of characters in the string.

<script type="text/javascript" language="javascript">

var txt="Hello World!";


The javascript code above outputs:

An objects can also be a property of another object. This object would be called a child object.


Objects can have methods. An object's method is a function that it can perform.

The javascript code example below uses the toUpperCase() method of the string object to display the text in uppercase letters.

<script type="text/javascript" language="javascript">

var str="Hello world!";


The javascript code above displays: