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
}
相关推荐
itmigrate4 小时前
前端项目里,Object.is 并不是 === 的平替
前端
程序员清风5 小时前
数据处理脚本工程化:日志、配置、命令行与测试
服务器·开发语言·数据库
小大宇6 小时前
Vue知识点6-computed计算属性
前端·javascript·vue.js
正在走向自律6 小时前
数据集成产品的技术底座:从日志解析原理到 KFS 同步链路搭建(含建表与增删改查完整代码)
数据库·oracle·信创·数据集成·国产数据库·kingbasees·全量+增量同步
程序员塔塔喵6 小时前
【MySQL篇|第七篇】MySQL事务
数据库·mysql·mysql事务
程序员海军6 小时前
尤雨溪 : Vue 4 已经在规划中了!
前端·javascript·vue.js
2601_949970696 小时前
HumanizeDuration 跨端三方库仓颉适配全流程
前端·javascript·flutter
独隅7 小时前
Claude API 实战教程:从入门到完整项目
android·java·数据库·claude·claude code
_孤傲_7 小时前
快速掌握 MySQL 语法
数据库·后端·mysql
风骏时光牛马8 小时前
后端服务接口开发与性能优化
前端