Next page | Contents page |

What is an object?

We have so far avoided defining a term which is fundamental to Javascript: the object. We have been using some examples of objects, such as document and the graphics context.

An object is not just a collection of data (called its "properties") but it also has functions (usually called its "methods"). We have seen this with the graphics context object. Its properties include fillStyle and lineWidth. Its methods include fillRect() and arc().

Organising programs as collections of objects enables a maintainable structure to be built when projects become large.

There may be several objects of the same type in a program. One of the basic types in Javascript is String and we have seen several of those already, their values written in quotes.

Next page | Contents page |