Node.js快速生成26个字母

const buf1 = Buffer.allocUnsafe(26); for (let i = 0; i < 26; i++) { // 97 是 'a' 的十进制 ASCII 值。 buf1[i] = i + 97; } console.log(buf1.toString('ascii')); // 输出: abcdefghijklmnopqrstuvwxyz console.log(buf1.toString('ascii', 0, 5)); // 输出: abcde

猜你喜欢

转载自www.cnblogs.com/h5it/p/10177613.html