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
}
相关推荐
凌虚8 分钟前
面向 MySQL 用户的 PostgreSQL 快速上手指南
数据库·后端·架构
五阿哥永琪17 分钟前
MySQL中操作json的函数!
数据库·mysql·json
用户0595401744622 分钟前
把AI对话记忆存储测试从手工改成Playwright+pytest,覆盖率从20%提到96%,回归时间缩短90%
前端·css
来者皆善22 分钟前
了解Mysql优化吗?如何优化索引?
数据库·mysql
kyriewen28 分钟前
别再这样写TypeScript了——Code Review中最常见的8个反模式
前端·javascript·typescript
名字还没想好☜34 分钟前
Next.js ‘use client‘ 到底加在哪:Server/Client Components 边界与常见报错
开发语言·前端·javascript·react·next.js
午安~婉1 小时前
GitHub Token/ GitHub Stats统计显示图异常
前端·github·vercel·github token
码云之上1 小时前
AI Agent 工程化总览篇:从 Prompt 到 Harness
前端·人工智能
2501_926978331 小时前
以说明书 DNA 为模板——完整 AGI 的结构图景
前端·人工智能·经验分享·笔记·ai写作
IT_陈寒1 小时前
Vite静态资源引用这个坑我踩得有点疼
前端·人工智能·后端