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
}
相关推荐
小波小波轩然大波5 分钟前
mysql技术
数据库·mysql
大学生资源网6 分钟前
基于Vue的网上购物管理系统的设计与实现(java+vue+源码+文档)
java·前端·vue.js·spring boot·后端·源码
diudiu_3311 分钟前
XSS跨站脚本攻击
前端·xss
终极前端开发协会12 分钟前
【web前端 - 齐枭飞】乾坤【qiankun】应用,主项目与子项目交互详细代码,里面有详细代码,可直接粘贴过去 直接应用 ,
前端·前端框架·交互
阿方索18 分钟前
MySQL
数据库·mysql
蓝影铁哥25 分钟前
浅谈国产数据库OceanBase
java·linux·数据库·oceanbase
闲蛋小超人笑嘻嘻27 分钟前
localStorage用法详解
前端
JosieBook29 分钟前
【大模型】用 AI Ping 免费体验 GLM-4.7 与 MiniMax M2.1:从配置到实战的完整教程
数据库·人工智能·redis
Swift社区30 分钟前
用 RN 的渲染模型,反推 Vue 列表的正确拆分方式
前端·javascript·vue.js
Mr_chiu30 分钟前
微前端从入门到精通:Vue开发者的大型应用架构演进指南
前端·架构