Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Brian Schmitz
11,167 PointsSetting the "Greeting" Variable challenge
Can someone please take a look at my code here and let me know where I am missing in trying to set up the Greeting variable. Much appreciated. Thanks
var genericGreet = function(name, mood) { name = name || "you"; mood = mood || "good"; return "Hello " + name + ", my name is " + this.name + " and I am in a " + mood + " mood!"; }
var andrew = {
name: "Andrew"
function(name, mood) {
name = name || "you";
mood = mood || "good";
return "Hello " + name + ", my name is " + this.name +
" and I am in a " + mood + " mood!";
}
}
var args1 = ["Michael", "awesome", ":)"];
var greeting = genericGreet.greet.apply(andrew, args1);
1 Answer

lordcozycat
11,940 PointsYour variable "greeting" is wrong. Simply remove the ".greet" :)
var greeting = genericGreet.apply(andrew, args1);
Brian Schmitz
11,167 PointsBrian Schmitz
11,167 PointsThanks Bryan. How about this last challenge in the prototypes section where they want us to set the prototype's wheels to 4. Here is my code:
wheels = new Car (4);
lordcozycat
11,940 Pointslordcozycat
11,940 PointsLike so:
After setting "Car.prototype" to equal the object "carPrototype", the last line creates a new key of "wheels" and gives it the value of 4, inserting it into the object.
This is probably the most confusing part of JavaScript to get a grip on, so do some Googling and rewatch the videos :)