how to grab the first word in a sentence javascript code example
Example 1: get the first word of a string javascript
let sentence = "The big brown fox"
let word = sentence.split(" ")[0]
console.log(word) // The
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)