get first letter of word javascript code example
Example 1: get first word of string js
let myStr = "Hello World"
let firstWord = myStr.split(" ")[0]
Example 2: javascript get first letter of each word
var msg = "Name Surname a"
var acronym = msg.match(/\b(\w)/g).join('');
console.log(acronym)