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
}
相关推荐
gplitems12313 分钟前
Consua WordPress Theme — Business Consulting Sites That Convert With Clarity
javascript
安当加密36 分钟前
达梦数据库TDE透明加密解决方案:构建高安全数据存储体系
网络·数据库·安全
雾削木2 小时前
stm32解锁芯片
javascript·stm32·单片机·嵌入式硬件·gitee
2301_768350232 小时前
Vue第二期:组件及组件化和组件的生命周期
前端·javascript·vue.js
小周同学:3 小时前
Vue项目中将界面转换为PDF并导出的实现方案
javascript·vue.js·pdf
Jabes.yang3 小时前
Java求职面试实战:从Spring Boot到微服务架构的技术探讨
java·数据库·spring boot·微服务·面试·消息队列·互联网大厂
华洛4 小时前
公开一个AI产品的商业逻辑与设计方案——AI带来的涂色卡自由
前端·后端·产品
明远湖之鱼4 小时前
opentype.js 使用与文字渲染
前端·svg·字体
阿巴~阿巴~4 小时前
Redis 核心文件、命令与操作指南
数据库·redis·缓存·客户端·服务端
koping_wu4 小时前
【Redis】用Redis实现分布式锁、乐观锁
数据库·redis·分布式