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 trialMax van den Berge
6,506 Pointsis this not a object literal?
https://teamtreehouse.com/library/creating-a-simple-callback-function#transcript
you can see we have a variable with my name and role.0:28 -->
Q: should the text not be: this is an object literal instead of a variable ... with my name and role ??
We also have a logTeacher function that takes the teacher, and0:33 prints out their name and role.
const person = { name: 'Andrew Chalkley', role: 'JavaScript Teacher' }
function logTeacher(teacher) {
console.log(${teacher.name} - ${teacher.role}
); }
logTeacher(person);
1 Answer
Steven Parker
231,236 PointsThat's really a variable, named "person". It's being assigned with an object literal, but "person" is a variable.
The name is the clue, object literals (any literals, for that matter) don't have names.