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
}
相关推荐
艺杯羹1 分钟前
数据库连接池技术与 Druid 连接工具类实现
java·数据库·mysql·jdbc
我爱Jack4 分钟前
Mybatis操作数据库(2)
java·数据库·mybatis
小袁拒绝摆烂7 分钟前
MySQL进阶篇-InnoDB引擎(超细)
数据库·mysql
伤不起bb11 分钟前
MySQL 故障排查与生产环境优化
数据库·mysql
island131421 分钟前
JAVA Web 期末速成
java·开发语言·前端
独行soc36 分钟前
2025年渗透测试面试题总结-安恒[实习]安全服务工程师(题目+回答)
linux·数据库·安全·web安全·面试·职场和发展·渗透测试
Violet_Stray1 小时前
mac下载、使用mysql
数据库·mysql·macos
小峰编程1 小时前
Python函数——万字详解
linux·运维·服务器·开发语言·前端·网络·python
海盐泡泡龟1 小时前
Javascript本地存储的方式有哪些?区别及应用场景?(含Deep Seek讲解)
开发语言·javascript·ecmascript
liweiweili1262 小时前
解决 MySQL 错误 1356 (HY000)
数据库·mysql