当前位置:网站首页>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
};
边栏推荐
- Talk about the design and implementation logic of payment process
- Technology at home and abroad people "see" the future of audio and video technology
- Classification and prediction of heartbeat signal
- Byte hexadecimal binary understanding
- Software evaluation center ▏ what are the basic processes and precautions for automated testing?
- U盘拷贝东西时,报错卷错误,请运行chkdsk
- Txt file virus
- UE4_UE5蓝图command节点的使用(开启关闭屏幕响应-log-发布全屏显示)
- Network security - phishing
- Clean C disk
猜你喜欢

Wechat forum exchange applet system graduation design (3) background function

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

What does the model number of asemi rectifier bridge kbpc1510 represent

Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades-KDD2020

Specific method example of V20 frequency converter manual automatic switching (local remote switching)

微信论坛交流小程序系统毕业设计毕设(4)开题报告

Wechat forum exchange applet system graduation design completion (8) graduation design thesis template

Use JfreeChart to generate curves, histograms, pie charts, and distribution charts and display them to jsp-2

Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?

二叉树(Binary Tree)
随机推荐
Gee (III): calculate the correlation coefficient between two bands and the corresponding p value
OC variable parameter transfer
Wechat forum exchange applet system graduation design completion (6) opening defense ppt
Network security - install CentOS
Matlab 信号处理【问答随笔·2】
JMeter interface automated test read case, execute and write back result
智慧社區和智慧城市之間有什麼异同
解决:信息中插入avi格式的视频时,提示“unsupported video format”
Oracle-数据库的备份与恢复
Some parameters of Haikang IPC
About idea cannot find or load the main class
Wechat forum exchange applet system graduation design (2) applet function
What are the similarities and differences between smart communities and smart cities
Locate to the bottom [easy to understand]
Network security - information query of operating system
The 19th Zhejiang Provincial Collegiate Programming Contest 2022浙江省赛 F.EasyFix 主席树
The wonderful relationship between message queue and express cabinet
Brush question 5
UE4_UE5蓝图command节点的使用(开启关闭屏幕响应-log-发布全屏显示)
网络安全-联合查询注入