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
}
相关推荐
qq_5896660515 小时前
TypeScript 完整入门教程
前端·javascript·typescript
聆听。。花开雨落16 小时前
mybatis的typeHandler 作用
数据库·mybatis
星栈独行16 小时前
翻完 Pi 源码:它和 Codex、Claude Code 有何不同
开发语言·javascript·人工智能·程序人生
pxzsky16 小时前
PG17数据库安装中分分词插件:pg_jieba
数据库·postgresql·pg_jieba
她说可以呀17 小时前
Redis哨兵
数据库·redis·bootstrap
落落Plus17 小时前
浏览器缓存机制详解
javascript·缓存·浏览器缓存
霸道流氓气质17 小时前
KMS 密钥管理服务(Key Management Service)原理与实践
linux·服务器·数据库
kirs_ur17 小时前
CXL(Compute Express Link)— 内存扩展的未来
服务器·数据库·性能优化
用户0595401744618 小时前
LLM对话记忆测试踩坑实录:手工回归30分钟,自动化后2分钟发现3个隐藏Bug
前端·css