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
}
相关推荐
new code Boy4 分钟前
前端base-64 编码解码
前端·javascript·html
严文文-Chris6 分钟前
【向量数据库到底是什么?】
数据库
老马聊技术8 分钟前
HBase单节点环境搭建详细教程
大数据·数据库·hbase
子夜江寒9 分钟前
Python 操作 MySQL 数据库
数据库·python·mysql
前端摸鱼匠11 分钟前
Vue 3 的watch监听多个数据源:讲解如何同时监听多个响应式数据的变化
前端·javascript·vue.js·前端框架·ecmascript
文心快码BaiduComate14 分钟前
用Spec给AI Agent立规矩,AI编码告别手忙脚乱
前端·后端·前端框架
东北小狐狸-Hellxz15 分钟前
后端生成的URL中含base64参数值,经tomcat重定向后偶发前端无法解密报错
java·前端·tomcat
梦帮科技16 分钟前
第二十二篇:AI驱动的工作流优化:性能瓶颈自动检测
数据结构·数据库·人工智能·python·开源·极限编程
Alex Gram23 分钟前
SQL Server实时同步到MySQL:构建高效跨数据库数据流通方案
数据库·mysql·sqlserver
在等星星呐28 分钟前
人工智能从0基础到精通
前端·人工智能·python