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
}
相关推荐
Leon-Ning Liu4 分钟前
【真实经验分享】Oradebug抓取阻塞源SQL语句
数据库
观远数据9 分钟前
消费品牌选型BI的能力边界:三类差异化场景的适配清单与排除项
数据库·人工智能·microsoft
玉宇夕落10 分钟前
详细流式输出学习
前端
秃头披风侠_郑15 分钟前
【uniapp】一文让你学会微信小程序+APP+H5全平台实战指南
前端·微信小程序·uni-app
嘟嘟071716 分钟前
从零搞懂 RAG 文档处理:逐行拆解 Loader 和 Splitter,一行代码背后发生了什么
前端
TlSfoward18 分钟前
爬虫指纹漂移监控与回归测试:JA3/JA4 变化为什么会影响线上验证 TLSFOWARD
数据库·爬虫·网络协议·搜索引擎
come1123419 分钟前
Vue 3 与现代 JavaScript 常用语法指南
前端·javascript·vue.js
dsyyyyy110120 分钟前
用JavaScript实现排序算法
开发语言·javascript·排序算法
槑有老呆21 分钟前
从零搭建 LLM 流式对话前端:一文读懂 SSE、二进制流与 Vue 3 响应式
前端·javascript
没落英雄22 分钟前
7. 从零开始搭建一个 AI Agent —— UI 卡片渲染系统
前端·人工智能·架构