javascript capitalize string
JavaScript
//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(); });
};const lower = 'this is an entirely lowercase string';
const upper = lower.charAt(0).toUpperCase() + lower.substring(1);function capitalize2(str) {
str = str.toLowerCase();
const arrOfWords = str.split(" ");
const arrOfWordsCased = [];
for (let i = 0; i < arrOfWords.length; i++) {
const char = arrOfWords[i].split("");
char[0] = char[0].toUpperCase();
res.push(char.join(""));
}
return arrOfWordsCased.join(" ");
}
Also in JavaScript:
- Title
- how to make item not dragable in react-sortablejs
- Category
- JavaScript
- Title
- include other js files in a js file
- Category
- JavaScript
- Title
- assign values to a table from javascript in VF page
- Category
- JavaScript
- Title
- Javascript compare two objects
- Category
- JavaScript
- Title
- express get params after ?
- Category
- JavaScript
- Title
- closure javascript
- Category
- JavaScript
- Title
- event.persist()
- Category
- JavaScript
- Title
- discord.js how to go back a file
- Category
- JavaScript
- Title
- how to align text inside react component
- Category
- JavaScript
- Title
- export function javascript
- Category
- JavaScript
- Title
- chart.js radar chart
- Category
- JavaScript
- Title
- find a single element in array of objects javascript
- Category
- JavaScript
- Title
- export apk react native
- Category
- JavaScript
- Title
- how to run different node app on server different domains
- Category
- JavaScript
- Title
- delete previous line node
- Category
- JavaScript
- Title
- default props react
- Category
- JavaScript
- Title
- how to check chrome version in js
- Category
- JavaScript
- Title
- how to iterate through an object in javascript
- Category
- JavaScript
- Title
- "..." in javascript
- Category
- JavaScript
- Title
- chartjs lineTension
- Category
- JavaScript
- Title
- how to write a program that alerts the first 3 letters of the current day in javascript
- Category
- JavaScript
- Title
- javascript anagram check
- Category
- JavaScript
- Title
- get args nodejs
- Category
- JavaScript
- Title
- angular observable subscribe and unsubscribe
- Category
- JavaScript
- Title
- create a form and submit it dynamically jquery
- Category
- JavaScript
- Title
- array of in javascript
- Category
- JavaScript
- Title
- enzyme test method
- Category
- JavaScript
- Title
- daterangepicker set maxdate
- Category
- JavaScript
- Title
- getelementbyid
- Category
- JavaScript
- Title
- how to change image source using javascript
- Category
- JavaScript
- Title
- .map function
- Category
- JavaScript
- Title
- accept 2 values after decimal in angular forms
- Category
- JavaScript
- Title
- columndefs in datatable not working while setting width jquery
- Category
- JavaScript
- Title
- defer parsing of javascript wordpress
- Category
- JavaScript
- Title
- how to add role in discord.js v12
- Category
- JavaScript
- Title
- base64 decode javascript
- Category
- JavaScript
- Title
- change select value jquery
- Category
- JavaScript
- Title
- javascript add to a dictionary
- Category
- JavaScript
- Title
- enter event in jquery
- Category
- JavaScript
- Title
- get value onChange from mat-select angular
- Category
- JavaScript
- Title
- how to make a random number guessing game in javascript
- Category
- JavaScript
- Title
- debug node
- Category
- JavaScript
- Title
- how to pass props in react test cases
- Category
- JavaScript
- Title
- ${ js
- Category
- JavaScript
- Title
- javascript addeventlistener
- Category
- JavaScript
- Title
- how to read json file in python
- Category
- JavaScript
- Title
- initialize a map js
- Category
- JavaScript
- Title
- ionic cordova icon notification
- Category
- JavaScript
- Title
- convert a int to a unicode javascript
- Category
- JavaScript
- Title
- how to substract date object javascript
- Category
- JavaScript
- Title
- clone a JavaScript object
- Category
- JavaScript
- Title
- if back react
- Category
- JavaScript
- Title
- how to redirect react router from the app components
- Category
- JavaScript
- Title
- check first two number jquery
- Category
- JavaScript
- Title
- angular material theme colors
- Category
- JavaScript
- Title
- function js
- Category
- JavaScript
- Title
- javascript ceiling
- Category
- JavaScript
- Title
- immediate invoke function js
- Category
- JavaScript
- Title
- bootstrap datepicker can be less than start date
- Category
- JavaScript
- Title
- add and remove class in jquery
- Category
- JavaScript
- Title
- Inserting HTML elements with JavaScript
- Category
- JavaScript
- Title
- how to use react components
- Category
- JavaScript
- Title
- how to generate a random number between 1 and 6 in javascript
- Category
- JavaScript
- Title
- how to access data in firebase realtime
- Category
- JavaScript
- Title
- api platform vue generator
- Category
- JavaScript
- Title
- angularjs class directive prepend
- Category
- JavaScript
- Title
- how to change input value in javascript using class
- Category
- JavaScript
- Title
- change text of element js
- Category
- JavaScript
- Title
- how to update react context inside functional component
- Category
- JavaScript
- Title
- how to read 2 dimensional array in javascript
- Category
- JavaScript
- Title
- If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will permanently disable this message but you might encounter other issues.
- Category
- JavaScript
- Title
- javascript check if element has class
- Category
- JavaScript
- Title
- how to check if object is undefined in javascript
- Category
- JavaScript
- Title
- adding element to array javascript
- Category
- JavaScript
- Title
- how to use js console log
- Category
- JavaScript
- Title
- array length javascript
- Category
- JavaScript
- Title
- and javascript
- Category
- JavaScript
- Title
- array shift javascript
- Category
- JavaScript
- Title
- bootstrap 4 form validator with jquery
- Category
- JavaScript
- Title
- aws amplify get JWT TOKEN
- Category
- JavaScript
- Title
- events in javascript
- Category
- JavaScript
- Title
- call function with id javascript
- Category
- JavaScript
- Title
- javascrip check if string contains substring
- Category
- JavaScript
- Title
- document addeventlistener click
- Category
- JavaScript
- Title
- angular check if control has required validator
- Category
- JavaScript
- Title
- how to add up all numbers in an array
- Category
- JavaScript
- Title
- getters and setters javascript
- Category
- JavaScript
- Title
- how to Write a program that simulates a coin toss using random method of Javascript Math class
- Category
- JavaScript
- Title
- Array Helpers
- Category
- JavaScript
- Title
- javascript classes
- Category
- JavaScript
- Title
- convert string with dot or comma as decimal separator to number in javascript
- Category
- JavaScript
- Title
- how to displayan inteiger to a tenth in javascript
- Category
- JavaScript
- Title
- 404 json laravel
- Category
- JavaScript
- Title
- import jquery
- Category
- JavaScript
- Title
- dropzone add download button addedfile
- Category
- JavaScript
- Title
- if statemnt shorthand js without else
- Category
- JavaScript
- Title
- create react app in existing folder
- Category
- JavaScript
- Title
- insert into mongodb node js
- Category
- JavaScript
- Title
- how to convert string to int js
- Category
- JavaScript
- Title
- angular http call caching issue even after no-cache
- Category
- JavaScript