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
}
相关推荐
深蓝轨迹几秒前
解决Redis排序后MySQL查询乱序问题:从原因到落地(通用版)
数据库·redis·笔记·mysql·bug
政采云技术1 分钟前
深入理解 setState 执行机制
前端·react.js
清汤饺子2 分钟前
Everything Claude Code:让我把 AI 编程效率再翻一倍的东西
前端·javascript·后端
jnrjian10 分钟前
预估 PURGE DBA_RECYCLEBIN 执行时间 v$SESSION_LONGOPS 6 秒限制
数据库·dba
西洼工作室11 分钟前
React TabBar切换与高亮实现
前端·javascript·react.js
belldeep14 分钟前
前端:Bootstrap 3.0 , 4.0 , 5.0 有什么差别?
前端·bootstrap·html
尽兴-18 分钟前
Git 分支管理核心命令科普指南
数据库·git·分支管理·代码仓库
wuhen_n19 分钟前
Tool Schema 设计模式详解
前端·javascript·ai编程
码喽7号19 分钟前
Vue学习三:element-plus组件和FontAwesome图标组件
前端·vue.js·学习
XDHCOM20 分钟前
Redis本地化实现策略与应用问题解析,如何配置Redis本地化,常见问题解决
数据库·redis·缓存