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
}
相关推荐
KaMeidebaby25 分钟前
卡梅德生物技术快报|PD1 单克隆抗体定制配套 N 糖全谱质控开发
前端·人工智能·算法·数据挖掘·数据分析
不会就选b1 小时前
MySQL之视图
数据库·mysql
nuIl1 小时前
实现一个 Coding Agent(3):工具调用
前端·agent·cursor
nuIl1 小时前
实现一个 Coding Agent(4):ReAct 循环
前端·agent·cursor
nuIl1 小时前
实现一个 Coding Agent(1):一次 LLM 调用
前端·agent·cursor
nuIl1 小时前
实现一个 Coding Agent(2):让 LLM 流式响应
前端·agent·cursor
copyer_xyf1 小时前
Python 异常处理
前端·后端·python
sugar__salt2 小时前
从栈队列数据结构到JS原型面向对象全解
前端·javascript·数据结构
>no problem<2 小时前
基于cola5.0的基础设施层的多数据库切换方案思路
数据库·spring boot·mybatisplus·cola5.0·数据库迁移适配
OceanBase数据库官方博客2 小时前
OceanBase 赋能央国企:从发电到用电的全链路业务承载
数据库·oceanbase