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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Brian Peirce](https://secure.gravatar.com/avatar/739505311a547ca8149fa43422bddf3a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Brian Peirce
15,434 PointsCode Challenge Works in Dev Tools But Not in the Workspace
For the "A Simple Merge Utility" code challenge, I submitted the attached code. It said I needed to re-examine my implementation, though I saw nothing wrong with what I did. I called a coworker over to look at it and he saw nothing wrong with it either. He then suggested that I try my algorithm in the Dev Tools console in Chrome where it ran fine. I'm still not sure what the exercise submission tool wants from me, so any help in this capacity would be appreciated.
var utilities = require("./utilities");
var mailValues = {};
mailValues.first_name = "Janet";
var emailTemplate = "Hi %first_name%! Thanks for completing this code challenge :)";
var mergedContent = utilities.merge(emailTemplate, mailValues);
//mergedContent === "Hi Janet! Thanks for completing this code challenge :)";
function merge(content, values) {
content = content.replace("%first_name%", values.first_name);
console.log(content);
return content;
}
module.exports.merge = merge;
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsBe careful about testing challenge code externally. Code can "run fine" but still not meet the specific objectives of the challenge. And examples given will usually never be extensive enough to verify meeting the objectives by themselves.
While the example shown replaces "first_name", the challenge is looking for the function to be able to replace any property of the supplied object, no matter what the property name(s) may be.