Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript (2015) Introduction to Methods Create an Object Literal

Anthony c
Anthony c
20,907 Points

Task 2/2

what does this mean?

"Assign your name to the fullName property on the contact object literal."

object.js
var contact = [];

The first task of this exercise asks you to make an empty object literal:

var contact = {};

The second task is too add a fullName property with the value of your name. The syntax for that looks like this:

var contact = {
  fullName: "Anthony"
};

3 Answers

Grace Kelly
Grace Kelly
33,990 Points

Hi Anthony, it means you need to assign a property name of "fullName" to the contact object literal and give it a value of your name, for example:

var contact = {
  fullName : "Grace Kelly"
};

Note: also I think you have incorrectly declared the object literal, it needs two curly brackets {}, not []

var contact = new Object(); contact.fullName = "John Doe";

what about ?

what about this?

var contact = new Object();
contact.fullName = "John Doe";