Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Correct Sentence solution in Clear category for Correct Sentence by apeorin
import assert from "assert";
function correctSentence(text: string): string {
const capitalized = text.charAt(0).toUpperCase() + text.slice(1);
return capitalized.endsWith('.') ? capitalized : capitalized.concat('.');
}
// 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 26, 2020