Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSamuel Lebender
5,119 Points"Unexpected symbol mysteryBird" Error message when I am doing exactly as told in the lesson
Hello, I've been following the lessons and I'm trying to complete this current problem but nothing I do works. No matter how well aligned it is with the instructions I am told. Furthermore if I name the var a single character instead of mysteryBird the code compiles but I am unable to turn it in because I have to name the var mysteryBird.
Thanks in advance
var birds = new[]
{
new { Name = "Pelican", Color = "White" },
new { Name = "Swan", Color = "White" },
new { Name = "Crow", Color = "Black" },
var mysteryBird = new {Color = "White", Sightings = 3}
};
1 Answer
Ismael Liriano
11,490 PointsHi Samuel! You're not totally wrong. The thing is, that the challenge is asking you to create a new variable outside the initialization of the bird array. Like this:
var birds = new[]
{
new { Name = "Pelican", Color = "White" },
new { Name = "Swan", Color = "White" },
new { Name = "Crow", Color = "Black" }
};
var mysteryBird = new { Color = "White", Sightings = 3};
You don't have to instantiate another anonymous object within the array.
Samuel Lebender
5,119 PointsSamuel Lebender
5,119 PointsThank you so much! I was legit at a loss for what to do.
once again thank you! :)