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
}
相关推荐
两点王爷1 小时前
数据库高频面试题详解:从四大隔离级别到 MVCC 与锁机制
数据库
Mh6 小时前
基于踩过的坑,浅聊一下vh、svh、lvh、dvh
前端·css·设计模式
刘小灰6 小时前
返璞归真,我开始更新博客了
前端·后端
lambo mercy8 小时前
08_redis__集群 (Cluster)
数据库·redis·缓存
圆心角8 小时前
Agent 上下文原理:为什么“记住”比“推理”更难
前端·面试·agent
富贵儿9988 小时前
NL2SQL 实践手记 08:SQL 没报错,答案为什么不对——从失败复盘到 Workflow 修复
数据库·python·sql·ai·自然语言处理·langchain
Decay__10 小时前
PostgreSQL 运维自动化平台 —— 部署编排、监控、巡检、告警、工单闭环一体化
运维·数据库·sql·mysql·架构
杜子不疼.11 小时前
从 Apache HTTP Server 到 CivetWeb:在鸿蒙 PC 的 3.1 MiB HAP 里嵌入 Web 服务器
前端·apache·harmonyos
0+11112 小时前
MySQL --基本查询
数据库·mysql