31. Properties


#1

REALLY stuck at this part and I really don't know what I'm doing with it. I think that I'm just really bad at coding XD
Anyway, I keep getting this error:

Oops, try again. It looks like you didn't save snoopy's species into species

This is the exercise that I'm stuck on: https://www.codecademy.com/courses/spencer-sandbox/5/2?curriculum_id=506324b3a7dffd00020bf661#

Cheers in advance :slight_smile:

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

var species = snoopy["species"];
var age = snoopy["age"];
// save Snoopy's age and species into variables
// use dot notation for snoopy's species
var species = snoopy.snoopySpecies;
    
// use bracket notation for snoopy's age
var age = snoopy["snoopy.age"];

#2

I see what you are trying to go for here. But I think you are going about it slightly wrong.

You first have to save Snoopy's species into a variable.

Then use bracket notation for saving snoopy's age into a variable.

// 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"];

#3

Ahhh, I see what I did wrong, I basically forgot what I was typing pretty much and completely messed it up at a result... No coding for me past 2AM now XD

Thank you very much though :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.