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
}
相关推荐
神奇霸王龙11 小时前
Agent 准入门控屠夫:5 旗舰 4 维度评估
linux·运维·数据库·ai·ai作画·agent·ai编程
鲸采云SRM采购管理系统11 小时前
采购管理系统哪家好?2026最新测评对比
java·服务器·数据库
一拳不是超人11 小时前
DeepSeek Harness 为什么敢说"一切皆插件"?拆透 Cordis 引擎的五大核心机制
前端·人工智能·agent
cfm_291411 小时前
基于Binlog实现不停机数据库平滑迁移技术
运维·数据库·架构
Full Stack Developme11 小时前
SQL 注入 的历史及设计工作原理
数据库·sql
Tisfy11 小时前
Codex:通过编辑配置文件添加带Bearer的自定义MCP
数据库·大模型·agent·codex·mcp
IT_陈寒11 小时前
Python的GIL让我多写了500行代码
前端·人工智能·后端
风骏时光牛马11 小时前
AI智能体能力调度微服务
前端
哈__12 小时前
面向AI智能体的数据库专业技能包:将DBA工程经验封装为可调用能力
数据库·人工智能·dba
阿坤带你走近大数据12 小时前
SQL里where后面的1=1是干嘛的,走的是什么索引
数据库·sql