当前位置:网站首页>leetcode-520. Detect capital letters -js
leetcode-520. Detect capital letters -js
2022-07-07 23:15:00 【Qianfan at the front】
subject 
Code
/** * @param {string} word * @return {boolean} */
var detectCapitalUse = function(word) {
// There is only one letter , Returns... Regardless of case true
if (word.length === 1) return true
const upperStr = word.toUpperCase()
const lowerStr = word.toLowerCase()
if (word === upperStr || word === lowerStr) {
// When all letters are uppercase or lowercase
return true;
} else if (word[0] <= 'Z' && word[0] >= 'A' && word.slice(1) === lowerStr.slice(1)) {
// When the first letter is capitalized , When all other letters are lowercase
return true
}
return false
};
边栏推荐
- What are the similarities and differences between smart communities and smart cities
- Network security - install CentOS
- Dynamics 365 查找字段过滤
- One question per day - pat grade B 1002 questions
- Grid
- 高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
- USB(十五)2022-04-14
- Wechat forum exchange applet system graduation design completion (8) graduation design thesis template
- Lecture 30 linear algebra Lecture 5 eigenvalues and eigenvectors
- iNFTnews | NFT技术的广泛应用及其存在的问题
猜你喜欢

Gbu1510-asemi power supply special 15A rectifier bridge gbu1510

iNFTnews | NFT技术的广泛应用及其存在的问题

微信论坛交流小程序系统毕业设计毕设(6)开题答辩PPT

Anta DTC | Anta transformation, building a growth flywheel that is not only FILA

Wechat forum exchange applet system graduation design completion (6) opening defense ppt

It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
![[microservices SCG] gateway integration Sentinel](/img/f3/410d7228b4b253ebf41015a785099f.png)
[microservices SCG] gateway integration Sentinel

微信论坛交流小程序系统毕业设计毕设(1)开发概要

Gee (IV): calculate the correlation between two variables (images) and draw a scatter diagram

14、 Two methods of database export and import
随机推荐
智慧社區和智慧城市之間有什麼异同
Adrnoid Development Series (XXV): create various types of dialog boxes using alertdialog
2022 words for yourself
Two kinds of curves in embedded audio development
微信论坛交流小程序系统毕业设计毕设(6)开题答辩PPT
JMeter interface automated test read case, execute and write back result
USB (十八)2022-04-17
U盘拷贝东西时,报错卷错误,请运行chkdsk
Software test classification
How to operate DTC community?
Network security - information query of operating system
网络安全-burpsuit
Clean C disk
Unity3D学习笔记6——GPU实例化(1)
Wechat forum exchange applet system graduation design (2) applet function
Some parameters of Haikang IPC
[network] Introduction to C language
Unity3D学习笔记5——创建子Mesh
十三、系统优化
Technology at home and abroad people "see" the future of audio and video technology