Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exercises/addCommas/addCommas.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function sliceNumber(num){
let numberString = num.toString();
while (numberString.length >= 3){
parts.push(numberString.slice(-3));
numberString = numberString.substring(0, numberString.length -3);
numberString = numberString.slice(0, -3);
}
if (numberString.length > 0){
parts.push(numberString);
Expand Down
14 changes: 7 additions & 7 deletions exercises/numberToEnglish/numberToEnglish.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function numberToEnglish(num) {
}

/// Join the strings in the descriptionWords array to form our result.
let result = descriptionWords.join(' ');
let result = descriptionWords.join(' ').trim();

/// Return the final result of the function
return result;
Expand Down Expand Up @@ -142,14 +142,14 @@ if (require.main === module) {
// How else will you know if your code does what you expect,
// or whether you've broken your existing code without realizing?

console.log(numberToEnglish(100) === 'one hundred ');
console.log(numberToEnglish(100) === 'one hundred');
console.log(numberToEnglish(0) === 'zero');
console.log(numberToEnglish(10) === 'ten ');
console.log(numberToEnglish(419) === 'four hundred nineteen ');
console.log(numberToEnglish(1423) === 'one thousand four hundred twenty three ');
console.log(numberToEnglish(10) === 'ten');
console.log(numberToEnglish(419) === 'four hundred nineteen');
console.log(numberToEnglish(1423) === 'one thousand four hundred twenty three');
console.log(numberToEnglish(1000000) === 'one million');
console.log(numberToEnglish(409) === 'four hundred nine ');
console.log(numberToEnglish(1000500) === 'one million five hundred ');
console.log(numberToEnglish(409) === 'four hundred nine');
console.log(numberToEnglish(1000500) === 'one million five hundred');
}

module.exports = numberToEnglish;