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
}
相关推荐
SkyWalking中文站5 小时前
BanyanDB 0.11.0:新特性与升级指南
数据库
宿6746 小时前
vue3-包管理器
前端·vue.js
@PHARAOH6 小时前
WHAT - Remix 入门和基本实践:理解两套产物
前端·remix
mayaairi7 小时前
Vue2 生命周期完全指南:从创建到销毁的8个钩子函数
前端·javascript·vue.js
₍˄·͈༝·͈˄*₎◞ ̑̑码7 小时前
MyBatis操作数据库
数据库·mybatis
研☆香7 小时前
一个简单的气泡弹窗制作
javascript
xy34537 小时前
axure9.0 如何打造一个计时器(简单版)
前端·ui·html·axure·原型·产品设计
大模型丫丫7 小时前
用 TypeScript、NestJS 和 LangGraph 搭建一个可控的 AI Agent
javascript·人工智能·typescript
IMPYLH8 小时前
HTML 的 <pre> 元素
前端·javascript·html
shmily麻瓜小菜鸡8 小时前
JavaScript / TypeScript 易踩坑知识点 —— 异步编程类
开发语言·javascript·typescript