You need to sign in or sign up before continuing.×
Retired
Mark Function (retired)
Loading description...
Fundamentals
View
Career Accelerator
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.
Nice kata.
Needs a fixed test
mark(0); markEnd();
and it needs to check result '=== 0', not '== 0'.Also, needs to specify what happens if I call
markEnd
with nothing marked left at all.Thx. Updated. Hava a look.
Needs random tests
How to do random tests
This would benefit from some kind of testing to prevent polluting
global
unnecessarily (like the example solution does .. :[ ). (Namespacing both functions would not be a bad idea either.)At the moment I have no idea how to write such a test, beyond enumerating
global
before and after, and allowing no more than two new keys. I don't even know if that'll work;global
might grow new keys for unexplained reasons (is that possible? is it predictable?).Your solution is more correct. But it' s difficult to make a test because global before is out of reach.