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
}
相关推荐
倔强的石头_44 分钟前
连接数失控排查:从数据库会话、应用线程池到连接池泄漏
数据库
hzxpaipai1 小时前
企业官网技术架构拆解:前端、后台、数据库、服务器如何协同
前端·数据库·架构
小磊哥er1 小时前
深入解构Claude Code - 第 12 篇 · 整体串起来
javascript·ai编程
小磊哥er1 小时前
深入解构Claude Code - 第 11 篇 · 工程上的讲究
javascript·ai编程
爱吃火鸡面呀2 小时前
MySQL DQL 子查询详解:从标量、列、行到表子查询的完整实战
大数据·数据库·mysql
harmony&2 小时前
OpenStack 云平台管理实战:从 Keystone 认证到 Nova 计算调度
数据库·openstack
betazhou3 小时前
Apache Seatunnel 抽取Oracle数据库测试
数据库·oracle·apache·seatunnel
深念Y3 小时前
Lenovo XiaoXinAir 14 — 性能模式切换
前端·网络
计算机魔术师4 小时前
Meta突然杀进第一梯队:一个新模型,把AI推理成本打下来8倍
前端