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
}
相关推荐
HarryHY1 分钟前
检查项目中的依赖是否有更新——npm outdated
前端·npm·node.js
十年砍柴---小火苗13 分钟前
vue的created和mounted区别
javascript·vue.js·ecmascript
rookiefishs15 分钟前
javascript如何实现手势🤚🏻的检测与识别?🤨
javascript
lens9416 分钟前
Oxlint:干掉ESLint卡顿!前端火箭级代码检查器来了!
前端·javascript
RePeaT17 分钟前
JavaScript切换元素显示隐藏的方法
前端·javascript
bitbitDown18 分钟前
同事用了个@vue:mounted,我去官网找了半天没找到
前端·javascript·vue.js
2401_8368365926 分钟前
mongodb数据库应用
数据库·mongodb
gs8014027 分钟前
机房断电后 etcd 启动失败的排查与快速恢复实录
数据库·etcd
孜然卷k41 分钟前
前端样式CSS设置 display: ‘grid‘, gridTemplateColumns: ‘repeat(4, 1fr)‘ 部分电脑展示内容溢出
前端·css
弓长三虎1 小时前
linux 命令审计
linux·运维·服务器·前端