I don't get this part: ;});
A semicolon is used at the end of most statements. We require it in our Road Trip courses, and although there is some debate, many see it as a good way to end statements. I'd recommend when starting out at least to put semicolons in at the end of statements where it's needed.
You use it after a function expression too. One of the few cases where you put it after a
}. Another I can think of is when an object literal comes at the end of a statement. Don't put it after
} in loops or function declarations.
} ends the function expression (i.e., is the anonymous function's closing brace), and the
) is the closing parenthesis for the
map function call.
And this only return the first name?
This will return an array with all the names. Each element of the resulting array will be a first and last name separated by a space.
Plus what happens when it doesn't get a array?
It won't work properly.**
** A more robust solution, beyond the scope of this course, may check if it's given an array. Lots of ways to do this and discussions around it but this is a really good place to get a good picture of how to do that: http://stackoverflow.com/questions/4775722/check-if-object-is-array