JavaScript Получите первую букву каждого слова
var msg = "Name Surname a"
var acronym = msg.match(/\b(\w)/g).join('');
console.log(acronym)
Innocent Ibex
var msg = "Name Surname a"
var acronym = msg.match(/\b(\w)/g).join('');
console.log(acronym)
let string = "Hello World"
let firstWord = typeof string.split(" ")[0] !== 'undefined' ? string.split(" ")[0] : null;
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)