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
}
相关推荐
_oP_i10 分钟前
mysql统计数据库使用存储大小
数据库
程序员黑豆16 分钟前
鸿蒙应用开发:Refresh + List 下拉刷新组件使用教程
前端·华为·harmonyos
Hilaku17 分钟前
为什么大厂对前端算法要求极高?
前端·javascript·程序员
会编程的土豆21 分钟前
MySQL 入门:库、表、行、主键是什么
linux·数据库·网络协议·http
你可如意23 分钟前
从Promise开始,一篇让你彻底建立起JS的异步编程模型
javascript
写代码的强哥37 分钟前
云原生数据库与传统数据库相比“新”在哪里
数据库·云原生·架构
Tkto38 分钟前
我用 WebGL 从「画个点」一路画到「贪吃蛇」
前端
xiaobaoyu1 小时前
前端代码常用规范
前端
xiaobaoyu1 小时前
img,word,excel,pdf文件在线预览
前端
lichenyang4531 小时前
从 H5 到 HarmonyOS:我做了一个 npm + OHPM 双端发布的 ArkWeb JSBridge 框架
前端