javascript convert to title case
function convertToTitleCase(str) {
return str.replace( /wS*/g, function(txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
}
var sentence=convertToTitleCase("we took a short walk.");//"We Took A Short Walk."
Also in JavaScript:
- toggle one class add and one class remove same time and after click remove class add and add class remove jquery
- cubic root javascript
- javascript get array object by id
- json parse string
- react get current route
- array of array key value javascript
- how to find remainder in javascript
- using a variable in regex javascript with boundary marker
- javascript get parameter
- rite a function that takes in an array of numbers and outputs the maximum number.
- copper reaction with water
- JQMIGRATE: jQuery.fn.keyup() event shorthand is deprecated
- convert string to datetime javascript
- convert string of expression in to expression in javascript
- how to access global scope in to local scope using javascript examples
- factorial javascript
- js check if object is empty
- javascript format date time
- Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
- how do you make a sprite with javascript
- javascript Error: Invalid web service call, missing value for parameter: 'documentId'.
- singly even magic square creation algorithm
- javascript if else
- match ids from 2 arrays in javascript asynchronous programming