js输出26个字母两种方法
Posted tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js输出26个字母两种方法相关的知识,希望对你有一定的参考价值。
方法一
var character = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z"); for(var i=0;i<25;i++) { alert(character[i]); }
方法二
for(var i=0;i<25;i++) { alert(String.fromCharCode((65+i))); }
附带:js大小写转换
strVariable.toUpperCase( ) 转大写
stringVar.toLowerCase( ) 转小写
以上是关于js输出26个字母两种方法的主要内容,如果未能解决你的问题,请参考以下文章