Write a function to convert a name into initials. This kata strictly takes two words with one space in between them. The output should be two capital letters with a dot separating them.
My code:
function abbrevName(name) {
let initials = name.split(' ');
return initials[0].slice(0, 1).toUpperCase() + '.' + initials[1].slice(0, 1).toUpperCase();
}
function abbrevName(name){
var nameArray = name.split(" ");
return (nameArray[0][0] + "." + nameArray[1][0]).toUpperCase();
}
New things I learned today: