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
}
相关推荐
PBitW12 分钟前
直接让GPT每日训练我!!!😕😕😕
前端·javascript·面试
爱勇宝21 分钟前
我给自己做了一个新标签页:不登录、不打扰、打开就能用
前端·html·浏览器
Ausra无忧1 小时前
记录在公司把单服务器升级成多服务器架构流程
前端·后端·架构
极客密码1 小时前
来看看我用Codex两周时间vibe coding的这款轻量级的剪贴板管理应用,win/mac系统均可用
前端·ai编程·vibecoding
前端双越老师2 小时前
Agent 实战: 智语 + baoyu-skills 自动发布文章到公众号
前端·agent·全栈
hunterandroid2 小时前
Jetpack Compose 入门:用声明式 UI 写 Android 页面
前端
以和为贵2 小时前
前端手写 RAG 踩坑实录:四个让检索"翻车"的坑
前端·人工智能·面试
用户2136610035722 小时前
Redux异步方案与React性能优化Hooks
前端
假如让我当三天老蒯2 小时前
TypeScript 继续学习(学习用)
前端·面试·typescript
玄玄子2 小时前
CSS 浮动引起父元素高度塌陷
前端·css