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
}
相关推荐
提笔了无痕5 小时前
Web中Token验证如何实现(go语言)
前端·go·json·restful
戌中横5 小时前
JavaScript——Web APIs DOM
前端·javascript·html
Beginner x_u5 小时前
如何解释JavaScript 中 this 的值?
开发语言·前端·javascript·this 指针
HWL56796 小时前
获取网页首屏加载时间
前端·javascript·vue.js
烟锁池塘柳06 小时前
【已解决】Google Chrome 浏览器报错 STATUS_ACCESS_VIOLATION 的解决方案
前端·chrome
速易达网络6 小时前
基于RuoYi-Vue 框架美妆系统
前端·javascript·vue.js
LYS_06186 小时前
RM赛事C型板九轴IMU解算(4)(卡尔曼滤波)
c语言·开发语言·前端·卡尔曼滤波
while(1){yan}7 小时前
Spring事务
java·数据库·spring boot·后端·java-ee·mybatis
盛世宏博北京7 小时前
高效环境管控:楼宇机房以太网温湿度精准监测系统方案
开发语言·数据库·php·以太网温湿度变送器
We་ct7 小时前
LeetCode 151. 反转字符串中的单词:两种解法深度剖析
前端·算法·leetcode·typescript