I have a user with a name Paul Steve Panakkal. It\'s a long name it won\'t fit to the div container. So is there anyway to split first name and lastname fro
I tried below code and it works cool for me
var full_name = 'xyz abc pqr';
var name = full_name.split(' ');
var first_name = name[0];
var last_name = full_name.substring(name[0].length.trim());
In above example:
(1)
If full_name = 'xyz abc pqr';
first_name = "xyz";
last_name = "abc pqr";
(2)
If `full_name = "abc"`:
Then first_name = "abc";
and last_name = "";