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
}
相关推荐
万少2 小时前
DeepSeek 昨晚刚开源了 Harness:附万少的2 万字保姆级教程
前端·后端·架构
程序员黑豆4 小时前
Java字符串详解
java·前端·ai编程
无我Code5 小时前
开发者-2026年中总结
前端·面试·程序员
To_OC6 小时前
LC 560 和为 K 的子数组:前缀和配哈希表,这对组合我是真的服了
javascript·算法·程序员
浮生望6 小时前
React 受控与非受控组件:从表单状态管理到实时校验的完整实践
前端
祈禾7 小时前
Redis三大缓存问题与分布式锁
运维·数据库·redis·笔记·分布式·缓存
明朝百晓生7 小时前
Deep RL learning[2026/8]
开发语言·javascript·人工智能
糖墨夕7 小时前
第二章:AI Agent 到底是个啥?—— 用生活场景把概念讲明白
前端
Csvn7 小时前
⚡ content-visibility: auto —— 长页面渲染提速的隐藏神器,白捡的性能优化
前端
DBA小马哥7 小时前
关系型数据库核心概念手册:SQL、事务与存储引擎的技术脉络
数据库·sql