15/17 newObject is not defined


#1

var pizza=newObject();
pizza.type="Pepperoni";
pizza.size="Large";

var newArray= [[7,8,8,9,0],["y","e"], [pizza]]

the error I am getting is ReferenceError: newObject is not defined

I checked the syntax on my object that I constructed outside of the array and it looks ok to me but isn't.. anybody see the problem? is it the way I've written my object?


#2

i just re-wrote my object like this:
var pizza={};
pizza.type="Pepperoni";
pizza.size= "Large";

and it worked... I still want to know why the other way didn't work though


#3

I believe 'newObject' needs to be separated by a space, 'new Object'. You are not creating a name 'newObject' but you are creating a 'new' 'Object'.


#4

got it, that makes sense.. im going to try that on the exercise i'm on right now (the contact list)


#10