Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Correct Sentence by mortonfox
"use strict";
function correctSentence(text) {
// returns a corrected sentence which starts with capital letter
// and ends with dot.
return text[0].toUpperCase() + text.slice(1) + (text.slice(-1) == '.' ? '' : '.');
}
// var assert = require('assert');
// if (!global.is_checking) {
// console.log('Example:')
// console.log(correctSentence("greetings, friends"))
// // These "asserts" using for self-checking and not for auto-testing
// assert.equal(correctSentence("greetings, friends"), "Greetings, friends.")
// assert.equal(correctSentence("Greetings, friends"), "Greetings, friends.")
// assert.equal(correctSentence("Greetings, friends."), "Greetings, friends.")
// assert.equal(correctSentence("hi"), "Hi.")
// console.log("Coding complete? Click 'Check' to earn cool rewards!");
// }
April 21, 2020