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
}
相关推荐
小冷coding2 小时前
【MySQL】MySQL 插入一条数据的完整流程(InnoDB 引擎)
数据库·mysql
尾善爱看海3 小时前
不常用的浏览器 API —— Web Speech
前端
鲨莎分不晴3 小时前
Redis 基本指令与命令详解
数据库·redis·缓存
专注echarts研发20年3 小时前
工业级 Qt 业务窗体标杆实现・ResearchForm 类深度解析
数据库·qt·系统架构
美酒没故事°4 小时前
vue3拖拽+粘贴的综合上传器
前端·javascript·typescript
jingling5555 小时前
css进阶 | 实现罐子中的水流搅拌效果
前端·css
周杰伦的稻香5 小时前
MySQL中常见的慢查询与优化
android·数据库·mysql
冉冰学姐5 小时前
SSM学生社团管理系统jcjyw(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面
数据库·ssm 框架·学生社团管理系统·多角色管理
悟能不能悟6 小时前
前端上载文件时,上载多个文件,但是一个一个调用接口,怎么实现
前端
nvd116 小时前
深入分析:Pytest异步测试中的数据库会话事件循环问题
数据库·pytest