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
}
相关推荐
Mike117.2 小时前
GBase 8a 日期边界写法和时间窗口取数偏差
数据库
余人于RenYu2 小时前
Claude + Figma MCP
前端·ui·ai·figma
SPC的存折3 小时前
1、Redis数据库基础
linux·运维·服务器·数据库·redis·缓存
杨艺韬5 小时前
vite内核解析-第2章 架构总览
前端·vite
我是伪码农6 小时前
外卖餐具智能推荐
linux·服务器·前端
2401_885885046 小时前
营销推广短信接口集成:结合营销策略实现的API接口动态变量填充方案
前端·python
小李子呢02116 小时前
前端八股性能优化(2)---回流(重排)和重绘
前端·javascript
程序员buddha6 小时前
深入理解ES6 Promise
前端·ecmascript·es6
吴声子夜歌7 小时前
ES6——Module详解
前端·ecmascript·es6
MatrixOrigin7 小时前
数据库没有死,只是范式变了
数据库·oracle