Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Correct Sentence by Sim0000
import assert from "assert";
function correctSentence(text: string): string {
if(!text.endsWith('.')) text += '.';
return text[0].toUpperCase() + text.slice(1);
}
console.log('Example:');
console.log(correctSentence('greetings, friends'));
// These "asserts" are used for self-checking
assert.equal(correctSentence('greetings, friends'), 'Greetings, friends.');
assert.equal(correctSentence('Greetings, friends'), 'Greetings, friends.');
assert.equal(correctSentence('Greetings, friends.'), 'Greetings, friends.');
console.log("Coding complete? Click 'Check' to earn cool rewards!");
April 24, 2020
Comments: