generate functionThu, 13 Jul 2023

Uppercase, which allows converting a text to uppercase except for those words whose first letter is already uppercase. Lowercase, which allows converting a text to lowercase, as long as the entered text is in uppercase. Extract, which allows extracting a word if the entered text consists of two or more words.

Script function toUpperCase(string){ return string.replace(/\w\S*/g, function(word){ return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase(); }); } function toLowerCase(string){ return string.toLowerCase(); } function extract(string){ return string.split(" ")[0]; }

Questions about programming?Chat with your personal AI assistant