js uppercase first letter


const str = `abc`; str.slice(0, 1).toUpperCase();
// "A"
str.slice(1).toLowerCase();
// "bc"
// js uppercase first letter
// capital / capitalization const log = console.log; const AutoUpperFirstIndexLetters = (str = ``, index = 1) => {
return str.slice(0, index).toUpperCase() + str.slice(index).toLowerCase();
} // test
const str = `abcdefg`; const result1 = AutoUpperFirstIndexLetters(str);
const result2 = AutoUpperFirstIndexLetters(str, 3); log(`result1 =`, result1);
// result1 = Abcdefg log(`result2 =`, result2);
// result2 = ABCdefg

refs

https://www.geeksforgeeks.org/how-to-make-first-letter-of-a-string-uppercase-in-javascript/



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有️xgqfrms, 禁止转载 ️,侵权必究️!


js uppercase first letter的更多相关文章

  1. js uppercase the first letter of string

    js uppercase the first letter of string js String.toUpperCase `-webkit-border-image`.split(`-`).filt ...

  2. Codeforces Round #250 (Div. 2)A(英语学习)

    链接:http://codeforces.com/contest/437/problem/A A. The Child and Homework time limit per test 1 secon ...

  3. Codeforces Round #290 (Div. 2) B. Fox And Two Dots dfs

    B. Fox And Two Dots 题目连接: http://codeforces.com/contest/510/problem/B Description Fox Ciel is playin ...

  4. Codeforces Round #288 (Div. 2)D. Tanya and Password 欧拉通路

    D. Tanya and Password Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/508 ...

  5. B. Fox And Two Dots

    B. Fox And Two Dots time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. CF Fox And Two Dots (DFS)

    Fox And Two Dots time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  7. The Unified Modeling Language(UML)

    统一过程建模语言UML 统一过程建模语言UML是一种标准的可视化建模语言,使用在:  业务建模和类似的过程 居于软件系统的分析.设计.和实现 UML 是一门通用语言,提供给业务分析员,软件架构师和开发 ...

  8. cf437A The Child and Homework

    A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input sta ...

  9. CodeForces - 508D Tanya and Password(欧拉通路)

    Description While dad was at work, a little girl Tanya decided to play with dad characters. She has ...

随机推荐

  1. 基于Python的接口自动化-unittest测试框架和ddt数据驱动

    引言 在编写接口自动化用例时,我们一般针对一个接口建立一个.py文件,一条接口测试用例封装为一个函数(方法),但是在批量执行的过程中,如果其中一条出错,后面的用例就无法执行,还有在运行大量的接口测试用 ...

  2. 事件循环Event loop到底是什么

    摘要:本文通过结合官方文档MDN和其他博客深入解析浏览器的事件循环机制,而NodeJS有另一套事件循环机制,不在本文讨论范围中.process.nextTick和setImmediate是NodeJS ...

  3. kvm实战

    1. 安装环境 # yum install qemu-kvm libvirt virt-install virt-manager virt-viewer -y # systemctl start li ...

  4. python(pymysql操作数据库)

    第一种方式 import pymysql # 打开数据库连接 db = pymysql.connect(host="192.168.88.11", user="root& ...

  5. jQuery 勾选显示

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  6. There are only two hard things in Computer Science: cache invalidation and naming things.

    TwoHardThings https://martinfowler.com/bliki/TwoHardThings.html https://github.com/cch123/golang-not ...

  7. ip_hash(不推荐使用) 会话粘性问题分析 Cookie 的 Session Sticky

    Nignx 连接tomcat时会话粘性问题分析_changyanmanman的专栏-CSDN博客_后端tomcat导致 前端elb中断 https://blog.csdn.net/cymm_liu/a ...

  8. java 本地方法(JNI)

    最近搞了一个调用第三方so库做登录认证的任务,以前对JNI没什么概念,最近学习了 <java核心技术> 本地方法 一章,把自己写的一些例子记录一下. 自己C语言真是渣渣,所以所有的例子都在 ...

  9. LOJ10043

    题目描述 原题来自:HNOI 2002 Tiger 最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况. Tiger 拿出了公司的账本,账本上记录了公司成 ...

  10. ubuntu 安装新版的qq,可支持下载文件等常用功能

    说明:此版本的QQ基本完美,但是有个缺点就是历史记录有些会显示乱码! 注意:此方法能完美解决这篇文章http://www.cnblogs.com/EasonJim/p/7118693.html的所有问 ...