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
}
相关推荐
一 乐3 分钟前
校园线上招聘|基于springboot + vue校园线上招聘系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·校园线上招聘系统
yuki_uix4 分钟前
虚拟 DOM 与 Diff 算法——React 性能优化的底层逻辑
前端·react.js·面试
时寒的笔记4 分钟前
js逆向7_案例惠nong网
android·开发语言·javascript
liliangcsdn4 分钟前
如何基于sentence_transformers构建向量计算工具
数据库·人工智能·全文检索
yuki_uix6 分钟前
从输入 URL 到页面显示——浏览器工作原理全解析
前端·面试
rchmin21 分钟前
向量数据库Milvus安装及使用实战经验分享
数据库·milvus
weixin_4080996723 分钟前
【完整教程】天诺脚本如何调用 OCR 文字识别 API?自动识别屏幕文字实战(附代码)
前端·人工智能·后端·ocr·api·天诺脚本·自动识别文字脚本
吴声子夜歌24 分钟前
ES6——Generator函数详解
前端·javascript·es6
吴声子夜歌25 分钟前
ES6——Set和Map详解
前端·javascript·es6
ego.iblacat26 分钟前
Python 连接 MySQL 数据库
数据库·python·mysql