Created
September 19, 2018 11:43
-
-
Save swapnilshrikhande/04564093e3b031f8e57f8d5417a8fc0e to your computer and use it in GitHub Desktop.
Split Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var splitName = function(fullName){ | |
var name = {}; | |
var nameComponents = fullName.split(' '); | |
name.firstName = nameComponents.slice(0, -1).join(' '); | |
name.lastName = nameComponents.slice(-1).join(' '); | |
return name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment