js实现字母序号递增

String.fromCharCode('A'.charCodeAt(0) + index)
// index 为数字

示例:

for (let index = 0; index < 4; index++) {
 	console.log(String.fromCharCode('A'.charCodeAt(0) + index))
}

结果:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/sxsssss/article/details/107695956