I have an object called user. I can get its name by user.name, and its value has both the first name and last name such as Jon Doe. What is the most efficient and elegant way of grabbing the first character up until the space character so that I get Jon?
I have an object called user . I can get its name by user.name
Share
The following will split the string on spaces, and will output the first element (in your case, this would be the first name).