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
}
相关推荐
小小码农Come on28 分钟前
Qt Creator + MSVC 2022 64bit 配置 Dump 文件生成与分析流程
数据库·qt
qiuyuyiyang33 分钟前
【MySQL】环境变量配置
数据库·mysql·adb
Cg1362691597437 分钟前
JS-对象-Dom案例
开发语言·前端·javascript
无限大61 小时前
《AI观,观AI》:善用AI赋能|让AI成为你深耕核心、推进重心的“最强助手”
前端·后端
烛阴1 小时前
Claude Code Skill 从入门到自定义完整教程(Windows 版)
前端·ai编程·claude
lxh01132 小时前
数据流的中位数
开发语言·前端·javascript
神仙别闹2 小时前
基于NodeJS+Vue+MySQL实现一个在线编程笔试平台
前端·vue.js·mysql
jgyzl2 小时前
2026.3.11MyBatis-Plus基本使用与思考
java·数据库·mybatis
RDCJM2 小时前
【MySQL】在MySQL中STR_TO_DATE()以及其他用于日期和时间的转换
android·数据库·mysql
vanvivo2 小时前
redis 使用
数据库·redis·缓存