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
}
相关推荐
cui_ruicheng4 小时前
MySQL(四):数据类型与字段设计
数据库·mysql
皮皮学姐分享-ppx4 小时前
政府绿色采购数据库(2015-2024.3)
大数据·网络·数据库·人工智能·制造
想吃火锅10054 小时前
【leetcode】405.数字转换为十六进制数js
开发语言·javascript·ecmascript
原则猫6 小时前
HOOKS 背后机制
前端
闪电悠米6 小时前
黑马点评-Redis 消息队列-03_stream_consumer_group
开发语言·数据库·redis·分布式·缓存·junit·lua
码语智行6 小时前
首页导航跳转功能深度解析-系统内和系统外
前端
DIY源码阁7 小时前
JavaSwing航班订票管理系统 - MySQL版
数据库·mysql
阿猫的故乡7 小时前
Vue过渡动画从入门到装X:淡入淡出、滑动、列表动画、第三方库全搞定
前端·javascript·vue.js
IManiy7 小时前
总结之Vibe Coding前端骨架
前端
小和尚敲木头7 小时前
vue3 vite动态拼接图片路径
javascript