Clip Art Objects
Pierce Home
Computer Science 555 Website Development using JavaScript and AJAX - 3 Units
Section:
3179
Instructor:
Brad Gilbert
Pierce Mailbox:
612
Email:
pierce@wavethunder.com
Wednesday Office Hours:
5:00 -   5:40 PM COSC 1507
Wednesday Lab:
5:45 -   7:50 PM COSC 1507
Wednesday Lecture:
7:55 - 10:00 PM MATH 1511
Other classes:
CS-575
objects
Question:

What is an object?

Answer:

Unlike a variable whose value is primitive data, such as number or string, an object is a complex structure that may contain several variables of various primitive data called properties, as well as actions called methods.

Question:

What is a property?

Answer:

A property is data that describes a characteristic about the object.

Question:

What is a method?

Answer:

A method is a function defined inside the object, so unlike a static property, a method performs an action.

Question:

What is an example of an object?

Answer:

In the real world, a car would be an example of an object. It has properties, such as color, model, and how many doors. It has methods, such as go forward, speed up, stop, and turn right.

In the JavaScript world, an example would be a string. It has a property: length, and methods: such as toUpperCase().

Question:

How do create an object?

Answer:

Please see the source code for the week 10 example. It shows how to define an object, as well as how to instantiate an object using the "new" keyword, and finally, how to use an object.

Brad Gilbert · Fall 2011
Computer Science · Pierce College · Woodland Hills CA · 818-719-6401