Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
13
Task/Comma-quibbling/JavaScript/comma-quibbling.js
Normal file
13
Task/Comma-quibbling/JavaScript/comma-quibbling.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
function quibble(words) {
|
||||
return "{" +
|
||||
words.slice(0, words.length-1).join(",") +
|
||||
(words.length > 1 ? " and " : "") +
|
||||
(words[words.length-1] || '') +
|
||||
"}";
|
||||
}
|
||||
|
||||
[[], ["ABC"], ["ABC", "DEF"], ["ABC", "DEF", "G", "H"]].forEach(
|
||||
function(s) {
|
||||
console.log(quibble(s));
|
||||
}
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue