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
}
相关推荐
陈天伟教授2 小时前
人工智能训练师认证教程(2)Python os入门教程
前端·数据库·python
Elastic 中国社区官方博客3 小时前
Elasticsearch:在分析过程中对数字进行标准化
大数据·数据库·elasticsearch·搜索引擎·全文检索
聪明努力的积极向上3 小时前
【MYSQL】字符串拼接和参数化sql语句区别
数据库·sql·mysql
信看3 小时前
NMEA-GNSS-RTK 定位html小工具
前端·javascript·html
代码or搬砖3 小时前
RBAC(权限认证)小例子
java·数据库·spring boot
Tony Bai3 小时前
【API 设计之道】04 字段掩码模式:让前端决定后端返回什么
前端
神仙别闹3 小时前
基于QT(C++)实现学本科教务系统(URP系统)
数据库·c++·qt
爱吃大芒果3 小时前
Flutter 主题与深色模式:全局样式统一与动态切换
开发语言·javascript·flutter·ecmascript·gitcode
2301_768350233 小时前
MySQL为什么选择InnoDB作为存储引擎
java·数据库·mysql