- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Let’s say the following is our string with name −
var studentFullName="John Smith";
Use split() to split the first name and last name. Following is the code −
var studentFullName="John Smith"; var details= var details=studentFullName.split(' '); console.log("StudentFirstName="+details) console.log("StudentLastName="+details);
To run the above program, you need to use the following command −
Here, my file name is demo163.js. This will produce the following output −
- Validate the first name and last name with Java Regular Expressions
- MySQL query to display columns name first name, last name as full name in a single column?
- MySQL GROUP BY and CONCAT() to display distinct first and last name
- How to recognize full name and last name in Open NLP?
- How to create separate columns for first and last name in R?
- Display records where first and last name begins with the same letter in MySQL
- Searching 2 fields at the same time to fetch a specific First Name and Last Name from a table in MySQL
- Select Statement to retrieve the same first names with similar last name (but different case) using MySQL?
- How to separate last name and first names in single column into two new columns in MySQL?
- Python program to print the initials of a name with last name in full?
- Java program to print the initials of a name with last name in full