31 Properties


#1

For some reason I'm having a problem understanding whats wrong here. I figure at this point I should be good at this. Here is what I have. Can some please look at this and let me know what I did wrong? Thank you in advance.

var snoopy = new Object();
snoopy.species = "beagle";
snoopy.age = 10;

// save Snoopy's age and species into variables
// use dot notation for snoopy's species
var species = new Object();
snoopy.species = "beagle";
snoopy.age = 10;

// use bracket notation for snoopy's age
var age = new Object();
snoopy["age"] = 10;
snoopy["species"] = "beagle";


#2

var snoopy = new Object();
snoopy.species = "beagle";
snoopy.age = 10;

// save Snoopy's age and species into variables
// use dot notation for snoopy's species
var species = snoopy.species;

// use bracket notation for snoopy's age
var age = snoopy["age"];

This worked for me! Not sure if I need the semi-colons at the ends but I figured why not.


#3

Thanks spaacejam. It worked!


#4

need help this is my code

var snoopy = new Object();
snoopy.species = "beagle";
snoopy.age = 10;

// save Snoopy's age and species into variables
// use dot notation for snoopy's species
var species = new Object();
this.species;

// use bracket notation for snoopy's age
var age = snoopy["age"];


#5

never mind i figured out my mistake it was to take away this.species and to change var species = new Object(); into var species = snoopy.species;