How would you go around to collect the first letter of each word in a string, as in to receive an abbreviation?
Input: "Java Script Object
"Java Script Object
This should do it.
var s = "Java Script Object Notation", a = s.split(' '), l = a.length, i = 0, n = ""; for (; i < l; ++i) { n += a[i].charAt(0); } console.log(n);