In fact, I am horrible with it
But I found the Codecademy site from a post here and I've been going on with that since last night and I've finished everything pretty easily except this one thing that I'm stuck with and they don't have a support forum or anything like that (for some reason :S).
I don't really understand what I'm supposed to be doing "code-wise". If anyone could help me that would be awesome
This is the "description" of the task.
If you try to access a property or method of the value undefined, you'll have an error.
This happens surprisingly often: for instance, person.name was not defined in the previous example. If you tried to do person.nmae.trim(), an error would be thrown.
trim is a function that removes trailing and leading whitespace from a string. For instance " foo " becomes "foo".
Try to implement a common pattern to deal with this issue by completing the trimName function according to the instructions in the comments.
And this is the start-code given.
[syntax=javascript]// trimName accepts a person as an argument. Person
// will always be an object.
// Return undefined if name is not defined. Otherwise,
// return a trimmed name.
function trimName(person) {
// If you do not set this variable to a value, it will be
// undefined.
var trimmedName;
// Do a check here to see if a person's name is defined.
if ( ) {
trimmedName = person.name.trim();
}
return trimmedName;
}[/syntax]
Again, I'm stuck because I don't understand the "description"