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
}
相关推荐
Csvn11 小时前
WASM
前端
w-w0w-w11 小时前
SQL注入
网络·数据库·sql
tianyuanwo11 小时前
NetBox 数据库详解:当“关系型数据库”被装进一个网络运维的领域模型里
运维·数据库·netbox
一条泥憨鱼11 小时前
【计算机网络】短连接、长连接与连接池:从 TCP 握手到池化复用的完整链路
网络·数据库·网络协议·tcp/ip·计算机网络
IvorySQL12 小时前
深入 PostgreSQL WAL:从崩溃恢复到逻辑复制
数据库·postgresql
修己xj12 小时前
我用 AI 给自己写了一个 Markdown 编辑器,然后把它开源了
前端
FRing0312 小时前
vue2干货总结2(v-bind、v-for、v-model、指令修饰符、v-bind操作class和style)
开发语言·前端·vue.js·vue2
幸运小猿13 小时前
模拟慢上传-处理超时重试image 丢失线上问题
前端·javascript·html
幽灵诶13 小时前
Mysql(基于测试的学习)
数据库·mysql
砚底藏山河13 小时前
python量化自定义周期 K 线合成
java·开发语言·数据库·python·金融