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
}
相关推荐
三天不学习3 分钟前
Tailwind CSS 快速入门(2026 版):从 v4 零配置上手,到「该不该用、怎么用好」的选型实战
前端·css·tailwind
明月_清风10 分钟前
面对陌生的 GitHub 项目无从下手?这 4 个网站帮你快速读懂源码
前端·后端·github
云贝贝贝15 分钟前
PostgreSQL 分区表:从设计到运维,大表不再卡
运维·数据库·postgresql
oradh16 分钟前
Oracle固定执行计划的方法---SQL Plan Baseline
数据库·sql·oracle
数据库小学妹21 分钟前
数据库高可用演练怎么做?稳态定义、注入点与中止条件
数据库·rto·高可用架构·运维体系·故障演练·容灾切换
zyseo822 分钟前
谷歌SEO 站内搜索优化实战:把站内搜索词变成关键词金矿
java·服务器·数据库
qq_4017004123 分钟前
Qt 串口/网口通信:Hex 与 ASCII 编码转换深度指南
开发语言·数据库·qt
码爸26 分钟前
多源异构数据库实时同步至 Doris
数据库·flink·scala
王大傻092830 分钟前
堆叠注入(Stacked Queries Injection)详解:原理、利用与防御
服务器·网络·数据库·web安全·网络安全
htzyl20635 分钟前
前端阶梯——第九章、颜色、文本与背景
前端·css