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
}
相关推荐
aa小小6 分钟前
localhost 访问异常排查笔记
前端
格子软件6 分钟前
2026年GEO优化系统源码的分布式状态机深度拆解
java·前端·vue.js·vue·geo
陈随易25 分钟前
Rust、Golang、MoonBit 编译成 WASM,体积和速度差距有多大?
前端·后端·程序员
IT_陈寒28 分钟前
Python多线程的坑,我居然现在才踩到
前端·人工智能·后端
摇滚侠34 分钟前
方法 A 等方法 B 执行完再执行 叫同步调用还是异步调用 JS 默认是同步调用还是异步调用
开发语言·javascript·ecmascript
阿拉斯攀登36 分钟前
向量数据库选型:Milvus vs Chroma vs Elasticsearch
数据库·elasticsearch·milvus·知识库·rag·个人知识库
彦为君1 小时前
Redis最新版本特性
java·数据库·redis·算法·bootstrap
vigor5121 小时前
MySQL通过Mango实现分库分表
android·数据库·mysql
weixin199701080161 小时前
[特殊字符]《京东订单API(jd.order.detail.get)对接ERP:企业认证+OAuth授权避坑指南》(附Python源码)
java·数据库·python
赵渝强老师1 小时前
【赵渝强老师】高斯数据库(openGauss)的模式
数据库·opengauss·国产数据库·高斯数据库