function joinStrings(n, f) {
let s = '';
for(let i=0; i<n; i++) {
s += f(i);
}
return s;
}
let digits = joinStrings(10, i=> i);
let randomChars = joinStrings(7, i=> String.fromCharCode(Math.floor(Math.random()*26) + 'a'.charCodeAt(0)));
console.log(digits);
console.log(randomChars);
JS-高階関数
-------
A [Pen](https://codepen.io/taquaki/pen/GOyXZN) by [Takaaki Sato](https://codepen.io/taquaki) on [CodePen](https://codepen.io).
[License](https://codepen.io/taquaki/pen/GOyXZN/license).