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
This commit is contained in:
@ -269,24 +269,24 @@
|
|||||||
"Remember to use <a href=\"http://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
"Remember to use <a href=\"http://forum.freeCodeCamp.com/t/how-to-get-help-when-you-are-stuck/19514\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
|
||||||
],
|
],
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"function findLongestWord(str) {",
|
"function findLongestWordLength(str) {",
|
||||||
" return str.length;",
|
" return str.length;",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"findLongestWord(\"The quick brown fox jumped over the lazy dog\");"
|
"findLongestWordLength(\"The quick brown fox jumped over the lazy dog\");"
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert(typeof findLongestWord(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: <code>findLongestWord(\"The quick brown fox jumped over the lazy dog\")</code> should return a number.');",
|
"assert(typeof findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === \"number\", 'message: <code>findLongestWordLength(\"The quick brown fox jumped over the lazy dog\")</code> should return a number.');",
|
||||||
"assert(findLongestWord(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: <code>findLongestWord(\"The quick brown fox jumped over the lazy dog\")</code> should return 6.');",
|
"assert(findLongestWordLength(\"The quick brown fox jumped over the lazy dog\") === 6, 'message: <code>findLongestWordLength(\"The quick brown fox jumped over the lazy dog\")</code> should return 6.');",
|
||||||
"assert(findLongestWord(\"May the force be with you\") === 5, 'message: <code>findLongestWord(\"May the force be with you\")</code> should return 5.');",
|
"assert(findLongestWordLength(\"May the force be with you\") === 5, 'message: <code>findLongestWordLength(\"May the force be with you\")</code> should return 5.');",
|
||||||
"assert(findLongestWord(\"Google do a barrel roll\") === 6, 'message: <code>findLongestWord(\"Google do a barrel roll\")</code> should return 6.');",
|
"assert(findLongestWordLength(\"Google do a barrel roll\") === 6, 'message: <code>findLongestWordLength(\"Google do a barrel roll\")</code> should return 6.');",
|
||||||
"assert(findLongestWord(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: <code>findLongestWord(\"What is the average airspeed velocity of an unladen swallow\")</code> should return 8.');",
|
"assert(findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\") === 8, 'message: <code>findLongestWordLength(\"What is the average airspeed velocity of an unladen swallow\")</code> should return 8.');",
|
||||||
"assert(findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: <code>findLongestWord(\"What if we try a super-long word such as otorhinolaryngology\")</code> should return 19.');"
|
"assert(findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\") === 19, 'message: <code>findLongestWordLength(\"What if we try a super-long word such as otorhinolaryngology\")</code> should return 19.');"
|
||||||
],
|
],
|
||||||
"type": "bonfire",
|
"type": "bonfire",
|
||||||
"isRequired": true,
|
"isRequired": true,
|
||||||
"solutions": [
|
"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": [
|
"MDNlinks": [
|
||||||
"String.prototype.split()",
|
"String.prototype.split()",
|
||||||
|
Reference in New Issue
Block a user