js输出26个字母两种方法(js fromCharCode的使用)

方法一

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( ) 转小写
上一篇:.net core2.x 自动注入 Entity(实体对象到上下文)


下一篇:jQuery Validate 表单验证 — 用户注册简单应用