functionformatWords(words){if(!words)return'';words=words.filter((word)=>word.length);letreturnString='';for(leti=0;i<words.length;i++){if(i===words.length-1&&i>0){returnString+=` and `;}elseif(i>0){returnString+=`, `;}returnString+=words[i];}returnreturnString;}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: Daily Coding Puzzles - Nov 11th - Nov 16th
Replies for: Wednesday - Format words into a sentence (6 KYU) Complete the method so that it formats the words into a single comma separated value. The last w...
For further actions, you may consider blocking this person and/or reporting abuse