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
}
相关推荐
u0109272712 小时前
RESTful API设计最佳实践(Python版)
jvm·数据库·python
2501_920931706 小时前
React Native鸿蒙跨平台采用ScrollView的horizontal属性实现横向滚动实现特色游戏轮播和分类导航
javascript·react native·react.js·游戏·ecmascript·harmonyos
0思必得08 小时前
[Web自动化] Selenium处理动态网页
前端·爬虫·python·selenium·自动化
qq_192779878 小时前
高级爬虫技巧:处理JavaScript渲染(Selenium)
jvm·数据库·python
东东5168 小时前
智能社区管理系统的设计与实现ssm+vue
前端·javascript·vue.js·毕业设计·毕设
u0109272718 小时前
使用Plotly创建交互式图表
jvm·数据库·python
爱学习的阿磊8 小时前
Python GUI开发:Tkinter入门教程
jvm·数据库·python
catino8 小时前
图片、文件的预览
前端·javascript
tudficdew9 小时前
实战:用Python分析某电商销售数据
jvm·数据库·python
sjjhd6529 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python