Retired
(Don't) Make Me Repeat Myself (retired)
3,254 of 3,418Neurotrace
Loading description...
Strings
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/109.
Please join the discussion to help us identify duplicate kata and retire them.
Retired.
No random tests
Node 12. should be enabled
Test.expect
should be replaced withassert.strictEqual
Test.expect
withassert.strictEqual
The description should clearly state what the function is supposed to do, even when it's obvious from the function name.
terrible description, no one knows what they have to do
Sorry, I wrote this about 7 years ago and at the time,
String.prototype.repeat
wasn't standardized. I've updated the description to better match modern expectations. Hope it helpsThis comment has been hidden.
fixed
This comment has been hidden.
Needs more tests...
Can anyone explain why it says I failed the test? That's my output:
aaa
ho ho ho
nananananananana
Test Failed: 'a'.repeat(3) should return 'aaa'
Agreed, the responses when testing the code are not very helpful. I'd much prefer seeing an error stating what actually did get returned/logged with my code rather than just the expected output. Basically like most other katas do...
Test should contain 0 repeats... which makes clear how the spec has gaps.
Repeat 0 should return the original. Repeat 1 should return the original and a repeat. If I repeat something, it's said twice.
OR
Repeat 0 returns empty string, Repeat 1 returns the original string.
{ expected: '', actual: 'ho '.repeat(0), msg: ''ho '.repeat(0) should return an empty string' },
This comment has been hidden.
FYI The JS code is executed server side. The errors you are seeing in the console is related to the application itself (and most likely the Ace editor plugin, which throws some of its own errors sometimes).
My first attempt didn't work on 'Attempt', it came back with an 'undefined' error. I checked my browser's console (Chrome), and it gave me the error 'cannot call replaced on undefined'. I wasn't trying to call a 'replaced' method anywhere myself. And I've since learned has happened to a few others on CodeWars (unsure whether it was this particular Kata, or otherwise)
I think this will be a cool kata for people to learn a little bit of JS code golf. ;)