Obtenga la primera palabra de cadena js
let myStr = "Hello World"
let firstWord = myStr.split(" ")[0]
Borma
let myStr = "Hello World"
let firstWord = myStr.split(" ")[0]
var msg = "Name Surname a"
var acronym = msg.match(/\b(\w)/g).join('');
console.log(acronym)
var x = 'some string';
alert(x.charAt(0)); // alerts 's'
var str = "Java Script Object Notation";
var matches = str.match(/\b(\w)/g); // ['J','S','O','N']
var acronym = matches.join(''); // JSON
console.log(acronym)