DekGenius.com
JAVASCRIPT
uppercase javascript
var str = "Hello World!";
var res = str.toUpperCase(); //HELLO WORLD!
uppercase javascript
let str = "Hello World!";
let res = str.toUpperCase();
console.log(res) //HELLO WORLD!
How to Use the toUpperCase() String Method in javascript
const string = "HeLLo woRld"
const uppercased = string.toUpperCase()
console.log(string)
// HeLLo woRld
console.log(uppercased)
// HELLO WORLD
to uppercase js
const string = "A string";
const upperCase = string.toUpperCase();
console.log(upperCase); // -> A STRING
const lowerCase = string.toLowerCase();
console.log(lowerCase); // -> a string
capitalize a string javascript
const Capitalize = function(string){
return string[0].toUpperCase + string.slice(1).toLowerCase;
}
string to capitalize javascript
const str = 'flexiple';
const str2 = str.charAt(0).toUpperCase() + str.slice(1);
console.log(str2);
//Output: Flexiple
const str = 'abc efg';
const str2 = str.charAt(0).toUpperCase() + str.slice(1);
console.log(str2);
//Output: Abc efg
uppercase javascript using function
function changeToUpperCase(founder) {
return founder.toUpperCase();
}
// calling the function
const result = changeToUpperCase("Quincy Larson");
// printing the result to the console
console.log(result);
// Output: QUINCY LARSON
JS .toUpperCase
.toUpperCase()
// Like this:
alert("In upper case: " + "my string".toUpperCase()); // In upper case: MY STRING
how to convert string to uppercase in javascript
const upperCase = (string) => {
const newText = string.toUpperCase();
return newText;
};
javascript uppercase function
const str = "This is a very long string!";
// This will return => "THIS IS A VERY LONG STRING!"
console.log(str.toUpperCase());
The toUpperCase JavaScript string method
//toUpperCase is a string method that returns the uppercased version of a specified string.
// We will use this to capitalize the first letter:
const firstLetter = "f"
const firstLetterCap = firstLetter.toUpperCase()
// F
capitalize text js
function capitalize (value:string) {
var textArray = value.split(' ')
var capitalizedText = ''
var conjunctions = ['the', 'of', 'a']
for (var i = 0; i < textArray.length; i++) {
if (conjunctions.includes(textArray[i])) {
continue
}
capitalizedText += textArray[i].charAt(0).toUpperCase() + textArray[i].slice(1) + ' '
}
return capitalizedText.trim()
}
© 2022 Copyright:
DekGenius.com