Skip to content

Commit 1b67e47

Browse files
committed
Merge pull request freeCodeCamp#7579 from erictleung/fix/unique-function-name-for-repeat-a-string
Make Repeat a String function name unique
2 parents 9cf2b49 + 6d05572 commit 1b67e47

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

seed/challenges/01-front-end-development-certification/basic-bonfires.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -365,25 +365,25 @@
365365
"Remember to use <a href=\"//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck\" target=\"_blank\">Read-Search-Ask</a> if you get stuck. Write your own code."
366366
],
367367
"challengeSeed": [
368-
"function repeat(str, num) {",
368+
"function repeatStringNumTimes(str, num) {",
369369
" // repeat after me",
370370
" return str;",
371371
"}",
372372
"",
373-
"repeat(\"abc\", 3);"
373+
"repeatStringNumTimes(\"abc\", 3);"
374374
],
375375
"tests": [
376-
"assert(repeat(\"*\", 3) === \"***\", 'message: <code>repeat(\"*\", 3)</code> should return <code>\"***\"</code>.');",
377-
"assert(repeat(\"abc\", 3) === \"abcabcabc\", 'message: <code>repeat(\"abc\", 3)</code> should return <code>\"abcabcabc\"</code>.');",
378-
"assert(repeat(\"abc\", 4) === \"abcabcabcabc\", 'message: <code>repeat(\"abc\", 4)</code> should return <code>\"abcabcabcabc\"</code>.');",
379-
"assert(repeat(\"abc\", 1) === \"abc\", 'message: <code>repeat(\"abc\", 1)</code> should return <code>\"abc\"</code>.');",
380-
"assert(repeat(\"*\", 8) === \"********\", 'message: <code>repeat(\"*\", 8)</code> should return <code>\"********\"</code>.');",
381-
"assert(repeat(\"abc\", -2) === \"\", 'message: <code>repeat(\"abc\", -2)</code> should return <code>\"\"</code>.');"
376+
"assert(repeatStringNumTimes(\"*\", 3) === \"***\", 'message: <code>repeatStringNumTimes(\"*\", 3)</code> should return <code>\"***\"</code>.');",
377+
"assert(repeatStringNumTimes(\"abc\", 3) === \"abcabcabc\", 'message: <code>repeatStringNumTimes(\"abc\", 3)</code> should return <code>\"abcabcabc\"</code>.');",
378+
"assert(repeatStringNumTimes(\"abc\", 4) === \"abcabcabcabc\", 'message: <code>repeatStringNumTimes(\"abc\", 4)</code> should return <code>\"abcabcabcabc\"</code>.');",
379+
"assert(repeatStringNumTimes(\"abc\", 1) === \"abc\", 'message: <code>repeatStringNumTimes(\"abc\", 1)</code> should return <code>\"abc\"</code>.');",
380+
"assert(repeatStringNumTimes(\"*\", 8) === \"********\", 'message: <code>repeatStringNumTimes(\"*\", 8)</code> should return <code>\"********\"</code>.');",
381+
"assert(repeatStringNumTimes(\"abc\", -2) === \"\", 'message: <code>repeatStringNumTimes(\"abc\", -2)</code> should return <code>\"\"</code>.');"
382382
],
383383
"type": "bonfire",
384384
"isRequired": true,
385385
"solutions": [
386-
"function repeat(str, num) {\n if (num < 0) return '';\n return num === 1 ? str : str + repeat(str, num-1);\n}\n\nrepeat('abc', 3);\n"
386+
"function repeatStringNumTimes(str, num) {\n if (num < 0) return '';\n return num === 1 ? str : str + repeatStringNumTimes(str, num-1);\n}\n\nrepeatStringNumTimes('abc', 3);\n"
387387
],
388388
"MDNlinks": [
389389
"Global String Object"

0 commit comments

Comments
 (0)