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
}
相关推荐
iFlyCai7 分钟前
深入理解Flutter:StatefulWidget生命周期全解析(四)
前端·javascript·flutter
致Great28 分钟前
Qwen3.8-Flash 发布:6B 激活,Qwen4 架构提前亮相
数据库·架构
张文君35 分钟前
ubuntu26.04从ext4改成raid1+lvm启动
数据库·postgresql
xm_xm_xm_139 分钟前
Vue 3 项目开发常用操作详细汇总
前端·vue.js
计算机魔术师41 分钟前
我国日均词元调用量突破 500 万亿,中国大模型稳居全球第一梯队
前端
夜雨声烦丿42 分钟前
从需求到页面:日期计算器应用的 ArkTS 原生实现
开发语言·javascript·华为·harmonyos
码视野1 小时前
基于 Spring Boot + Vue3 的【高校化学实验室安全准入考试与危化品配伍排查系统】设计与实现(含PRD/三端高保真源码/大屏)
前端·人工智能·spring boot·后端·安全·vue3
鲨鱼辣钊1 小时前
FastAPI筑基_Day15_Alembic数据库迁移实战
数据库·elasticsearch·fastapi
玄魂1 小时前
VisActor 全新图可视化开源项目:VGraph
前端·数据可视化
叫我:松哥1 小时前
基于Flask的教师评教管理系统,支持学生和教师两种角色登录
数据库·后端·python·数据挖掘·flask