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
}
相关推荐
Setsuna_F_Seiei1 小时前
性能优化 - 列表分页查询的优化
前端·vue.js·性能优化
Setsuna_F_Seiei1 小时前
性能优化 - Vue.js 的懒加载的优化封装
前端·vue.js·性能优化
3095566662 小时前
股票接口重试怎么分类:正常、空数组与错误响应的幂等处理
java·大数据·开发语言·数据库·php·api接口·股票数据api接口
excel2 小时前
Prisma 查询不到 SQL 更新后的字段?先别急着重新打包
前端
城北徐宫3 小时前
MySQL基础与库、表操作
数据库·mysql
狗头大军之江苏分军4 小时前
《潮水漫过十七岁》倒计时
前端·javascript·后端
码完就睡4 小时前
Redis——初识 Redis
数据库·redis·缓存
小码哥0685 小时前
租房平台源码部署验收:房源样例、区域字典与看房预约逐项验证
前端·javascript·vue.js·租房小程序·租房系统·租房软件
htzyl2066 小时前
JS原型链与继承:class 底下到底是什么
前端·javascript·ecmascript 6
一条Go6 小时前
15 套品牌色 + 双模式:把颜色关进三层 token
前端·github