Arrays and Objects in JS Lesson 12


#1

So, I just started writing objects and I wanted to make sure I got thorough practice right off. So, in addition to writing the objects I tried to call components of the objects. Can someone help me fix this? Thanks!

Arrays and Objects in JS Lesson 12
https://www.codecademy.com/courses/javascript-beginner-en-9Sgpi/2/4?curriculum_id=506324b3a7dffd00020bf661#

This is the error message I’m receiving from the console:
“ReferenceError: object is not defined”

```
var object1 = {
    numbers: [2, 3, 4],
    letters: ["A", "B", "C", "D", "E", "F", "G"]
}



var object2 = new Object();
object2.animals = ["pig", "dog", "cat", "fish", "bird"]
object2.namethem = function(){
    console.log(object.animals[3]);
}
object2.namethem();

var object3 = new Object();
object3["teams"] = ["Red Sox", "Yankees", "Cubs", "Braves"];
object3["Playoffs"] = function (){
    var team1 = object3.teams[Math.floor(Math.random()*4)-2];
    var team2 = object3.teams[Math.floor(Math.random()*2)+2];
    console.log("The two teams heading to the playoffs are "+team1 + " and " + team2 + "!");
}
object3.Playoffs();
<do not remove the three backticks above>

#2

here:

 console.log(object.animals[3]);

i think you intended to use object2, there is no object named object


#3

Thank you!!! It worked!


#4