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
}
相关推荐
葡萄城技术团队8 小时前
1000 人协同压测的环境瓶颈排查:CPU 争用与 Wi\-Fi
前端
ClickHouseDB8 小时前
ClickHouse Cloud 与 Snowflake 实时性价比对比:CostBench 测试中的 412 倍差距来
运维·数据库·系统架构
m0_639906948 小时前
Redis入门|五种数据结构、使用场景、持久化RDB&AOF
数据结构·数据库·redis
excel9 小时前
Marked 与 Markdown 有什么区别?该怎么选?
前端
时间售卖铺9 小时前
触发器与函数实战:MySQL高效编程秘诀
运维·数据库·mysql·云原生
qetfw10 小时前
UOS MariaDB 数据库:安装、最小权限与备份验证
linux·数据库·mariadb·uos
Da Da 泓10 小时前
五子棋 Web 端测试用例报告
前端·网络·websocket·网络协议·测试用例·项目
数智园区合作社10 小时前
问数平台怎么把同一个指标锁成一个数
大数据·数据库·人工智能·ai
zxcvb15311 小时前
远程查看本地文档:一条轻量 Web 文件服务的工程化链路
前端·远程查看文档
lbb 小魔仙11 小时前
Windows搭建PaddleOCR+飞书Webhook自动打卡通知机器人:识别、推送与远程触发完整教程
数据库·人工智能·prometheus·时序数据库