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
}
相关推荐
weixin_4643076337 分钟前
设置程序自启动
前端
小满zs42 分钟前
Next.js第十七章(Script脚本)
前端·next.js
小满zs2 小时前
Next.js第十六章(font字体)
前端·next.js
喝拿铁写前端7 小时前
别再让 AI 直接写页面了:一种更稳的中后台开发方式
前端·人工智能
悄悄敲敲敲8 小时前
MySQL表的约束
数据库·mysql
鼠爷ねずみ8 小时前
SpringCloud前后端整体开发流程-以及技术总结文章实时更新中
java·数据库·后端·spring·spring cloud
A向前奔跑8 小时前
前端实现实现视频播放的方案和面试问题
前端·音视频
十一.3668 小时前
131-133 定时器的应用
前端·javascript·html
九皇叔叔8 小时前
MySQL 数据库 Read View 详解
数据库·mysql·mvcc·read view