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
}
相关推荐
AgCl2311 分钟前
MYSQL-5-DCL数据查询语言-3/16
数据库·mysql
flytam12 分钟前
Claude Agent SDK 深度入门指南
前端·aigc·agent
IvorySQL20 分钟前
PostgreSQL 技术日报 (4月7日)|内核开发新动态,多项功能优化落地
数据库·postgresql·开源
weixin1997010801627 分钟前
《电天下商品详情页前端性能优化实战》
前端·性能优化
速易达网络28 分钟前
vue+echarts开发的图书数字大屏系统
前端
IvorySQL34 分钟前
PostgreSQL 技术日报 (4月6日)|内核补丁与性能优化速递
数据库·postgresql·开源
小智社群37 分钟前
贝壳获取小区的名称
开发语言·前端·javascript
IvorySQL44 分钟前
PostgreSQL 技术日报 (4月5日)|六大核心补丁进展,生产环境必看
数据库·postgresql·开源
Ferries1 小时前
《从前端到 Agent》系列|03:应用层-RAG(检索增强生成,Retrieval-Augmented Generation)
前端·人工智能·机器学习
Jessica_Lee1 小时前
Openclaw智能体终止机制
javascript