当前位置:网站首页>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
};
边栏推荐
- ArcGIS: two methods of attribute fusion of the same field of vector elements
- JMeter-接口自动化测试读取用例,执行并结果回写
- USB(十四)2022-04-12
- Unity dynamically merges mesh textures
- 网络安全-burpsuit
- Digital collections accelerated out of the circle, and marsnft helped diversify the culture and tourism economy!
- Bea-3xxxxx error code
- Brush question 3
- Unity3D学习笔记6——GPU实例化(1)
- Specific method example of V20 frequency converter manual automatic switching (local remote switching)
猜你喜欢

The wonderful relationship between message queue and express cabinet

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

Comparison of various development methods of applets - cross end? Low code? Native? Or cloud development?

GEE(四):计算两个变量(影像)之间的相关性并绘制散点图

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

二叉树(Binary Tree)

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

V20变频器手自动切换(就地远程切换)的具体方法示例

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

Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
随机推荐
聊聊 Dart 的空安全 (null safety) 特性
Inftnews | the wide application of NFT technology and its existing problems
USB(十五)2022-04-14
Brush question 4
ArcGIS: field assignment_ The attribute table field calculator assigns values to fields based on conditions
Some parameters of Haikang IPC
Grid
Wechat forum exchange applet system graduation design completion (4) opening report
2021-01-11
Bit operation
Why does the market need low code?
微信论坛交流小程序系统毕业设计毕设(6)开题答辩PPT
Software evaluation center ▏ what are the basic processes and precautions for automated testing?
Matlab 信号处理【问答随笔·2】
网络安全-sqlmap与DVWA爆破
opencv scalar传入三个参数只能显示黑白灰问题解决
2021ICPC上海 H.Life is a Game Kruskal重构树
Digital collections accelerated out of the circle, and marsnft helped diversify the culture and tourism economy!
ArcGIS: two methods of attribute fusion of the same field of vector elements
Unity3D学习笔记6——GPU实例化(1)