You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
abbrev_name = function (str1) {
|
|
var split_names = str1.trim().split(" ");
|
|
if (split_names.length > 1) {
|
|
return (split_names[0] + " " + split_names[1].charAt(0) + ".");
|
|
}
|
|
return split_names[0];
|
|
};
|
|
console.log(abbrev_name("Robin Singh"));
|