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 trialmeghana Joshi
4,596 PointsMy code works on console but never works on the challenge page . It is so frustrating.
Here is my code:
const authors = [
{ firstName: "Beatrix", lastName: "Potter" },
{ firstName: "Ann", lastName: "Martin" },
{ firstName: "Beverly", lastName: "Cleary" },
{ firstName: "Roald", lastName: "Dahl" },
{ firstName: "Lewis", lastName: "Carroll" }
];
let fullAuthorNames;
fullAutorNames = authors.map(function(author){
return author.firstName + " " + author.lastName
});
const authors = [
{ firstName: "Beatrix", lastName: "Potter" },
{ firstName: "Ann", lastName: "Martin" },
{ firstName: "Beverly", lastName: "Cleary" },
{ firstName: "Roald", lastName: "Dahl" },
{ firstName: "Lewis", lastName: "Carroll" }
];
let fullAuthorNames;
fullAutorNames = authors.map(function(author){
return author.firstName + " " + author.lastName
});
// fullAuthorNames should be: ["Beatrix Potter", "Ann Martin", "Beverly Cleary", "Roald Dahl", "Lewis Carroll"]
// Write your code below
2 Answers
Steven Parker
231,248 PointsYou just have a little typo/spelling error: This code is putting the result in a variable named "fullAutorNames" (with no "h") but the variable that the challenge is expecting the result in is " fullAuthorNames" (with the "h").
Those "little things" can often be the most frustrating! And a different variable name is exactly the kind of thing the console won't care about but the challenge will.
meghana Joshi
4,596 Pointsthanks