Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This is clever indeed but also makes the code too vague
If I were to make my own programming language, I would make sure to make nonsense like this completely impossible.
Muito bom!
Wow, so much dislikes... just an additional proof that I'm right.
This challenge is as old as Codewars itself. There were no mods 12 years ago. It was approved and ranked by the author of Codewars.
A few comments
Maybe, instead of thinking how to change the function without changing the function, start thinking about why and how the unittest fails in the first place. This will help you come up with a solution.
The whole point of the Kata was to show that you can in fact change the behavior of the function from outside using JavaScript.
But you need to take a few steps back and think about how JavaScript actually works and which peculiarities it has. The function looks simple, but how does JavaScript execute it actually?
I do not want to give too many clues. If you can't come up with a solution, simply skip it.
Just be aware that in real life as a programmer you sometimes also have such "mysteries" where you think "it can't be", until finally you understand that you overlooked something that is important that might influence the behavior of your program. Or something that you simply never knew or imagined your programming language or library would do under the hood.
I do not know why you call this "opinion". This particular challenge has a solution (which you said is impossible) and the solution is a single line of pure JS without calling any native functions or messing with runtime or anything of this kind (which you say would be necessary). So how is it that there is 1100 solutions and none of them does any native mumbo-jumbo and does not rewrite code at runtime and does no runtime specific shenanigans. It's 6 kyu, it uses very basic mechanisms of the language. JavaScript is not a pure, side-effects-free language, and behavior of a JS function can be affected by many factors, including other places in the program, and not just by how the function is written. That's how bugs are done.
There is no need to be bitter over a challenge which you don't like. It's a puzzle, not everyone has to like puzzles, and anyone who does not like puzzles can just move along. But being unable to solve it and getting all grumpy because of that and throwing tantrums is just lame.
You are entitled to your own opinion.
This is very wrong.
If the code in question doesn't use an external library (or, frankly, any non-native function) then, indeed, there is no way to modify its behavior without directly changing it (unless you switch to good ol' C and use
#define
).Yes, it's possible. It's strange that a programmer would think that modifying one piece of code somewhere couldn't possibly have the effect of changing the behavior of different code in a different location.
I would tell you that I just completed the challenge so it seems pretty possible, but since this does not matter, then I won't.
The fact that, based on what the description is saying (and the tests), you are expected to modify the behavior of
countdown
without changing it. And that is not possible no matter what you tell me.Loading more items...