Codewards - Abbreviate a Two Word Name

PHOTO EMBED

Tue Apr 12 2022 12:09:24 GMT+0000 (Coordinated Universal Time)

Saved by @Luduwanda #javascriptreact

//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.
//It should look like this:
//Sam Harris => S.H
//patrick feeney => P.F

function abbrevName(name){
  let initials = name.split(" ")
  return initials[0].charAt(0).toUpperCase()+'.' + initials[1].charAt(0).toUpperCase(); 
    
}
content_copyCOPY