Mistake with class name #36

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@LecheFrita

In the class definition there is a little mistake.

@LecheFrita LecheFrita Update index.html
In the class definition there is a little mistake.
b6aa283
@taitems
Owner

Err, nope? Run it in your console, it works fine.

@LecheFrita

Ummm i thought that you was defining the item you would pass into the function "greet(user)"

@taitems
Owner

Nope. user is the only parameter of the function greet.

function greet(user) {
   alert(user.name + ", who is a " + user.age + " year old " + user.gender + ", says '" + user.message + "'.");
}

greet({
   name: "Tait",
   gender: "male",
   age: "24",
   message: "Good evening!"
});

It's to avoid cases where you would normally have:

function greet(name,age,gender,message,height,weight,etc) { }

Passing the parameters in as an object also allows for it to be extended over defaults etc.

@taitems taitems closed this Jan 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment