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
}
相关推荐
奇特認3 小时前
mysql 集群技术 3.高可用之 MHA
数据库·mysql
油丶酸萝卜别吃3 小时前
utils.js 说明文档
开发语言·javascript·ecmascript
zyplayer-doc6 小时前
VuePress类静态文档站和动态知识库怎么选:两种技术路线的适用场景
javascript·人工智能·后端·安全·智能手机
Bioinfo Guy6 小时前
高分Panel复现系列|转录因子网络太乱?用模块框把重点圈出来
数据库·生物信息学·生信可视化
紫禁玄科7 小时前
Shai-Hulud:npm生态的自我复制蠕虫风暴
前端·npm·node.js
ltl7 小时前
Disaggregated DB 合集:Socrates、PolarDB、Taurus 的共同模式
数据库
东风破_7 小时前
后端API没写好,前端难道干等着吗?
前端
用户938515635078 小时前
从前后端分离到前端接口工程:React + MockJS + Vite 解析
前端·后端·全栈
用户938515635078 小时前
从零在浏览器里跑 DeepSeek-R1:WebGPU + Transformers.js 全链路实战(三)
前端·react.js·typescript
excel8 小时前
当前端行情变差,我们为什么还要坚持?
前端