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
}
相关推荐
Dovis(誓平步青云)1 分钟前
家里设备越来越多,如何用一张空间地图控制灯光和温度![
android·java·前端·javascript·人工智能·电脑
程序员清风3 分钟前
CSV、Excel 与数据库数据读取实践
数据库·oracle·excel
穆梓兰煊3 分钟前
TS5.7 vs 裸JS:AI应用少3坑
前端
榆瓷12 分钟前
闲着没事,我把 WebGPU 的样板代码封成了一个库
前端
1360967572319 分钟前
页面打不开不是 Nginx 的错
前端·后端
xieter20 分钟前
【技术精选】TypeScript 高级类型体操:条件类型与模板字面量深度剖析 (2026-10-06)
javascript
GEO实战经验分享20 分钟前
GEO技术与工具全景:从监测仪表盘到Schema的实战指南
数据库
一个天蝎座的程序猿24 分钟前
IoTDB集群扩容:从慌乱到从容的经验分享
数据库
ss2731 小时前
AI全栈实战 | 3.3-02 Python 并发:有 GIL 为什么还用多线程,asyncio 和 JS 事件循环同源不同味
开发语言·javascript·python
liangshanbo12151 小时前
高级前端面试题:package.json 常见字段
前端·json