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
}
相关推荐
我的xiaodoujiao4 分钟前
使用PyMySQL模块技术操作MySQL数据库
数据库·python·测试工具·mysql
风月说与山鬼5 分钟前
二、uni-app入口文件(main.js)
javascript·uni-app
常宇佳15 分钟前
vue3 $refs使用方法
前端·vue.js·typescript
zhanghaha131417 分钟前
HTML系列教程:4_什么是 HTML 元素(零基础超详细讲解)
前端·算法·html
AI 编程助手GPT1 小时前
VS Code 1.133 实战:Claude 可免 GitHub 登录,HTML 保存后自动刷新
前端·html·github
灯澜忆梦2 小时前
【基于GO的Web开发3】gin框架_HTML渲染
前端·golang·gin
zmzmzmalo3 小时前
Linux ELF文件加载与内存管理揭秘
linux·网络·数据库
小徐_23338 小时前
wot-ui-cli 1.1.0 发布:支持 OpenCode、Antigravity,wot-ui 图标迁移不再靠猜
前端
__zRainy__9 小时前
Node.js Web 框架选型指南:从 Express 到 Hono 的全景对比
前端·node.js·express·koa·nestjs·egg·fastify
西瓜有点饿9 小时前
PostCSS 和 UnoCSS 的作用和区别
前端·postcss