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
}
相关推荐
李木子qaq6 分钟前
什么是数据库代理
数据库·proxy模式
LNN20229 分钟前
半导体设备上位机 Qt 实现计划
开发语言·数据库·qt
牧瀬クリスだ9 分钟前
MYSQL的视图
数据库·mysql
m0_7414817813 分钟前
SQL删除包含敏感信息的数据_使用数据脱敏后执行删除
jvm·数据库·python
IT_陈寒14 分钟前
JavaScript实战技巧总结
前端·人工智能·后端
2401_8822737214 分钟前
如何用立即执行函数(IIFE)创建独立的作用域隔离变量
jvm·数据库·python
TDengine (老段)15 分钟前
TDengine 时序数据库在城市燃气场景的落地实践
大数据·数据库·人工智能·物联网·时序数据库·tdengine·涛思数据
玲小珑17 分钟前
AI Coding 与 Harness 实践精髓:让AI高效干活、持续交付
前端·人工智能·openai
七夜zippoe18 分钟前
DolphinDB查询优化:执行计划分析
大数据·数据库·信息可视化·dolphindb·查询优化
skilllite作者18 分钟前
Agent-Skills 核心能力与实战效能深度评测
大数据·开发语言·前端·数据库·人工智能·python