What Is the Difference Between an Object Constructor and an Object Literal ?
Problem
You want to know what the difference is between creating an object using the new operator or an object literal.
Solution
Object literals are usually easer to read. When creating an object literal, you can assign properties at the same time. Using a object constructor can create an object but will require extra lines to define properties.
The Code
Listing 9-1. Objects Can Be Created Using Either the Object Constructor or by Creating an Object Literal
var R2D2 = ...