hallo again klml,
Dein bsp. koennte dann auch so aussehen (copy+paste in die jconsole):
var copy = "Anfangsbuchstaben Wörter per RegEx";
var wordList = copy.split(/\s+/);
var autolemma = wordList.shift();autolemma = wordList.reduce((function (previous, current) {
return (previous + current.charAt(0));
}), autolemma.charAt(0));
das ganze laesst sich auch kuerzer schreiben:
~~~javascript
var copy = "Anfangsbuchstaben Wörter per RegEx";
var autolemma = copy.split(/\s+/).reduce((function (previous, current) {
return (previous + current.charAt(0));
}), "");
print(autolemma);
so long - peterS. - pseliger@gmx.net
--
»Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies.
Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.« - Douglas Crockford
ie:( fl:) br:> va:( ls:& fo:) rl:) n3;} n4:} ss:} de:µ js:} mo:? zu:]
»Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies.
Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.« - Douglas Crockford
ie:( fl:) br:> va:( ls:& fo:) rl:) n3;} n4:} ss:} de:µ js:} mo:? zu:]