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
}
相关推荐
JSMSEMI114 分钟前
JSM12N60C 600V N沟道增强型功率MOSFET
开发语言·javascript·ecmascript
ihuyigui6 分钟前
国际商超零售短信接口
大数据·前端·后端·架构·零售
Yan-英杰6 分钟前
从零玩转搜索引擎 API: 多引擎整合实战
服务器·前端·microsoft
Spider_Man11 分钟前
Claude Code Hooks:给 AI 助手装上"安全带"
前端·ai编程·claude
minji...15 分钟前
MySQL数据库 (四) MySQL的数据类型,tinyint,float,decimal,枚举enum和集合set
数据库·mysql·tinyint·enum·decimal·varchar·bit
lichenyang45315 分钟前
HarmonyOS 6.0 ArkUI 循环渲染:ForEach、LazyForEach 和 Repeat 到底怎么选?
前端
Captaincc30 分钟前
置身钉内:一个 AI 办公产品的理想、失焦与组织困境
前端·程序员
阿演35 分钟前
DataDjinn 新版本更新:国产数据库支持、连接树体验、AI 查询和表格编辑继续增强
数据库·人工智能·ai·ai编程
零陵上将军_xdr39 分钟前
后端转全栈学习-Day6-JavaScript 基础-4
前端·javascript·学习
川冰ICE42 分钟前
JavaScript实战②|电商网站交互效果,轮播图与购物车
开发语言·javascript·交互