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
}
相关推荐
sg_knight1 分钟前
微信小程序中 WebView 组件的使用与应用场景
前端·javascript·微信·微信小程序·小程序·web·weapp
Wang's Blog10 分钟前
MySQL: 基准测试全流程指南:原理、工具(mysqlslap/sysbench)与实战演示
数据库·mysql
q***062915 分钟前
如何在 Windows 上安装 MySQL(保姆级教程2024版)
数据库·windows·mysql
百***069423 分钟前
MySQL 创建新用户及授予权限的完整流程
数据库·mysql
全栈工程师修炼指南36 分钟前
奇技淫巧 | 巧用阿里云免费 ESA:获取用户真实IP地址与地理位置
数据库·阿里云·云计算
凯子坚持 c40 分钟前
生产级 Rust Web 应用架构:使用 Axum 实现模块化设计与健壮的错误处理
前端·架构·rust
IT_陈寒1 小时前
Python 3.12新特性实战:5个让你的代码效率翻倍的隐藏技巧!
前端·人工智能·后端
程序员小寒1 小时前
前端高频面试题之Vuex篇
前端·javascript·面试
网硕互联的小客服1 小时前
如何解决 Linux 文件系统挂载失败的问题?
linux·服务器·前端·网络·chrome