javascript string first letter lowercase
//capitalize only the first letter of the string.
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
//capitalize all words of a string.
function capitalizeWords(string) {
return string.replace(/(?:^|\s)\S/g, function(a) { return a.toUpperCase(); });
};function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
console.log(capitalizeFirstLetter('foo')); // Foo// for lowercase on first letter
let s = "This is my string"
let lowerCaseFirst = s.charAt(0).toLowerCase() + s.slice(1)
Also in JavaScript:
- discord js check if person banned
- jquery get the parent node
- jquery doc on ready
- content type json
- js check if array
- live background react
- double question mark javascript
- get value in tag with id JS
- how to set three js canvas width 100%
- js remove the last character of a string
- get execution time in javascript
- javascript array add
- jquery remove option from select by value
- json search javascript
- install nodejs ubuntu 19.04
- jquery change font color
- UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
- unordered list in react native
- how to get width of inline elements js
- shorthand if in javascript with return
- fetch download blob file
- find length of longest string in array javascript
- make object move towards player p5js
- formating decimal hours as hours and minute javascript