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
}
相关推荐
书唐瑞31 分钟前
谷歌浏览器和火狐浏览器对HTML的嗅探(Sniff)能力
前端·html
rocky19140 分钟前
谷歌浏览器插件 使用 playwright 回放用户动作键盘按键特殊处理方案
前端
扑克中的黑桃A44 分钟前
金仓多模数据库平替MongoDB的电子证照国产化实践——从2TB数据迁移到1600+并发支撑
数据库
rocky19144 分钟前
playwright里兼容处理回放无界微前端内iframe内部元素事件和不在无界微前端内的iframe元素
前端
rocky1911 小时前
谷歌浏览器插件 使用 playwright 回放slide 拖动动作
前端
计算机毕业设计小帅1 小时前
【2026计算机毕业设计】基于Django的社区婴幼儿预防接种系统
数据库·django·课程设计
Devil枫1 小时前
HarmonyOS鸿蒙应用:仓颉语言与JavaScript核心差异深度解析
开发语言·javascript·ecmascript
惺忪97981 小时前
回调函数的概念
开发语言·前端·javascript
友友马1 小时前
『 数据库 』MySQL复习 - 内置函数详解
数据库·mysql
前端 贾公子1 小时前
Element Plus组件v-loading在el-dialog组件上使用无效
前端·javascript·vue.js