From e20916f9b0fe6e64a21aef9723d35d2bad97e766 Mon Sep 17 00:00:00 2001 From: Usman Hussain Date: Thu, 3 Aug 2017 11:25:45 +0500 Subject: [PATCH] fix(seed): Function name findLongestWord changed The function name findLongestWord is a little misleading as the challenge asks to return the length of the word not the word itself. Name findLongestWordLength is perfect. BREAKING CHANGE: Function name changed --- .../basic-algorithm-scripting.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting.json b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting.json index 9655657ca8..493914142d 100644 --- a/seed/challenges/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting.json +++ b/seed/challenges/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting.json @@ -269,24 +269,24 @@ "Remember to use Read-Search-Ask if you get stuck. Write your own code." ], "challengeSeed": [ - "function findLongestWord(str) {", + "function findLongestWordLength(str) {", " return str.length;", "}", "", - "findLongestWord(\"The quick brown fox jumped over the lazy dog\");" + "findLongestWordLength(\"The quick brown fox jumped over the lazy dog\");" ], "tests": [ - "assert(typeof findLongestWord(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: findLongestWord(\"The quick brown fox jumped over the lazy dog\") should return a number.');", - "assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: findLongestWord(\"The quick brown fox jumped over the lazy dog\") should return 6.');", - "assert(findLongestWord(\"May the force be with you\") === 5, 'message: findLongestWord(\"May the force be with you\") should return 5.');", - "assert(findLongestWord(\"Google do a barrel roll\") === 6, 'message: findLongestWord(\"Google do a barrel roll\") should return 6.');", - "assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") should return 8.');", - "assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") should return 19.');" + "assert(typeof findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") should return a number.');", + "assert(findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") should return 6.');", + "assert(findLongestWordLength(\"May the force be with you\") === 5, 'message: findLongestWordLength(\"May the force be with you\") should return 5.');", + "assert(findLongestWordLength(\"Google do a barrel roll\") === 6, 'message: findLongestWordLength(\"Google do a barrel roll\") should return 6.');", + "assert(findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\") should return 8.');", + "assert(findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\") should return 19.');" ], "type": "bonfire", "isRequired": true, "solutions": [ - "function findLongestWord(str) {\n return str.split(' ').sort(function(a, b) { return b.length - a.length;})[0].length;\n}\n\nfindLongestWord('The quick brown fox jumped over the lazy dog');\n" + "function findLongestWordLength(str) {\n return str.split(' ').sort(function(a, b) { return b.length - a.length;})[0].length;\n}\n\nfindLongestWordLength('The quick brown fox jumped over the lazy dog');\n" ], "MDNlinks": [ "String.prototype.split()",