Sometimes, we want to split first name and last name using JavaScript.
In this article, we’ll look at how to split first name and last name using JavaScript.
How to split first name and last name using JavaScript?
To split first name and last name using JavaScript, we use the split
method.
For instance, we write
const names = "Paul Steve Jones".split(" ");
to call split
with ' '
to split the names into an array of name strings.
Conclusion
To split first name and last name using JavaScript, we use the split
method.