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
}
相关推荐
無限進步D1 分钟前
MySQL 单行函数
数据库·mysql
Nian.Baikal8 分钟前
从零搭建离线地图服务:Nginx + Cesium/Leaflet 实战指南
运维·前端·nginx
zithern_juejin8 分钟前
new 运算符
javascript
前端毕业班11 分钟前
uniapp web 灵活控制 style scoped
前端·javascript·vue.js
lichenyang45314 分钟前
鸿蒙业务需求实战:AI 问题走马灯卡片实现复盘
前端
ZTStory28 分钟前
mise 一款可以在项目中独立管理语言、环境变量和任务的工具
前端·rust·命令行
雁北向30 分钟前
骨架屏 巴飞特 测试
前端
吴佳浩30 分钟前
用 Stitch 实现 AI 前端工程化:找回消失的UI美学(别再 Vibe 瞎Coding 了)
前端·人工智能·llm
AI人工智能+电脑小能手37 分钟前
【大白话说Java面试题 第77题】【Mysql篇】第7题:回表查询与全表扫描的区别?
java·开发语言·数据库·mysql·面试
lichenyang45343 分钟前
鸿蒙业务 UI 实战复盘:AI 问题走马灯卡片与 ArkTS 基础语法
前端