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
}
相关推荐
IT_陈寒10 分钟前
Vue的这个响应式陷阱,让我加班到凌晨三点
前端·人工智能·后端
tiancaijiben12 分钟前
阿里云SAE应用引擎弹性扩缩容完全指南:从手动调控到智能自动化
java·网络·数据库
2501_9160074714 分钟前
抓包工具对比 Charles、Fiddler、TraceEagle、Wireshark 与 Proxyman
前端·网络协议·ios·adb·https·fiddler·wireshark
倔强的石头_20 分钟前
8000 条 SQL 里,180 条外连接语义跑偏——Oracle 迁 KES 那些藏得最深的坑
数据库
逆境不可逃42 分钟前
RAG 不只是向量数据库:讲透 Chunk、混合检索、重排、引用与权限治理
数据库·oracle
小堂子这厢有礼了1 小时前
Chet.QuartzNet.UI v2.3.0 大更新!表格重构 + 系统配置 + 分析页全面升级!
前端·后端·ui·重构·c#·vue
触底反弹1 小时前
⚡ Promise.all 性能优化:让 Agent 的工具调用飞起来
javascript·人工智能·后端
程序员爱钓鱼1 小时前
Rust 控制流 if 详解:条件判断与 if 表达式
前端·后端·rust
全堆鸿蒙1 小时前
鸿蒙应用开发实战【36】— 数据查询优化:predicates 链式调用
数据库·harmonyos·鸿蒙系统
91刘仁德1 小时前
MySQL 数据库基础操作知识点整理
数据库·mysql·oracle