Hi All,

This is my first post, probably of many as I learn javascript. I'm trying to teach myself using codeschool / code academy and I'm having issues on one very large concept -- functions. I understand the premise, but I've never used them before in the applications I am good with, like excel / crystal reports. Anywho, I was trying to build a simple function which takes the zero position in an array and splits it up. The first position in the array is a full name (first name last name). The function should split this using space as a deliminator. This is what I have so far

Code:
var array = ["Leeroy Jenkins", "WhelpLover"];
function splitName (newArray){
newArray = array[0].split (" ");
}

So when I run this through jsconsole, the return is "undefined". If I remove the function aspects of it, and only use

Code:
var array = ["Leeroy Jenkins", "WhelpLover"];
newArray = array[0].split (" ");
newArray;
the return I get is correctly ["Leeroy","Jenkins"]. Can anyone provide insight on what I'm doing wrong with the function? Really appreciate it!

Thanks in advance,
Grij