Detect Pangram(js练习题codewars)

A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is irrelevant).

Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation.

javascript 复制代码
function isPangram(string){
  let abc = 'abcdefghijklmnopqrstuvwxyz'
  let arr = abc.split('');
  str = string.toLowerCase()
  for(let c of str){
    let idx = arr.indexOf(c)
    if(idx > -1){
      arr.splice(idx,1)
    }
    
    if(arr.length == 0){
      return true
    }
  }
  return false
}
相关推荐
天天喝旺仔11 分钟前
MySQL索引优化实战:B+Tree原理、索引失效与覆盖索引调优
数据库·sql·mysql·性能优化
其实防守也摸鱼23 分钟前
DeepSeek Harness 开源贡献手记:从入门到合入主线
服务器·数据库·windows·https·ssl
Omics Pro30 分钟前
AI药物研发10原则!欧盟EMA×美国FDA
数据库·人工智能·算法·机器学习·自然语言处理
杨云龙UP32 分钟前
DB2 HADR 主备切换实战:SQL1639N 认证问题、备库只读与双向 Takeover
linux·运维·数据库·db2·主备切换·角色互换
吠品32 分钟前
Nginx负载均衡配置与线上故障排查的一些经验
java·开发语言·数据库
flash俊杰1 小时前
ASR 转写与字幕时间轴:强制对齐、CPS 约束与 SRT 工程化
前端
前端炒粉1 小时前
AI工具面经
前端
达梦数据1 小时前
达梦数据复制软件DMDRS搭建部署示例:源数据库DM8到目标数据库DM8双向数据同步
数据库
唐小码1 小时前
裁员的风刮到了三线荒凉的城市
前端