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 trialBlaine Fallis
2,449 PointsWhen I try to use "Employee Number" as part of the object, I get an error: Uncaught SyntaxError: Unexpected string
re:
var me = {
first_name: "Jim",
last_name: "Hoskins"
"Employee Number": 1
}
console.log(me.first_name);
console.log(me.last_name);
console.log(me["Employee Number"]);
console.log(me);
3 Answers
Goran Penov
1,635 PointsI have the same error. Did you figure it out?
Goran Penov
1,635 Pointsvar me = {
first_name: "Goran",
last_name: "Penov",
"Employee Number": 1
}
console.log(me.first_name);
console.log(me.["last_name"]);
console.log(me["Employee Number"]);
console.log(me);
ashok bishnoi
512 Pointsyou have put (;) you need to put (,) after end of each.
Carlton Stith Jr.
9,077 Pointsvar me = {
first_name: "Carlton",
last_name: "Stith",
"Employee Number": 1
}
console.log(me.first_name);
console.log(me["last_name"]);
console.log(me["Employee Number"]);
console.log(me);
Blaine Fallis
2,449 PointsBlaine Fallis
2,449 Pointswhoops, there's no comma after Hoskins. I caught that after hitting submit :)