30.what are objects for?


var spencer = {
age: 22,
country: "United States"

// make spencer2 here with constructor notation
var spencer2 = new Object();

var spencer2.age = 22;
var spencer2.country = "United States";

at the end of the code, why it doesn't work when it has 'var' ???


You are literally making a new variable that has a period in it. I have never seen a variable with a period in it :slightly_smiling: .

according to your code..

spencer2.age is a separate variable to spencer2

Once you declare the variable once no need to use var again or you will make that mistake.

Hope that helps :sunny: