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.
debatable as to whether this is good practice or not, but history proved you wrong by adding full-fledged classes to JavaScript, with private and static properties
The value in list[0].language can be anything, but as he specified the [0] index and the loop runs through every object, it will only return true if all the other objects has the same language of the [0] index
You should refer to sample tests and throw the corresponding message instead of an empty string
There can be valid reasons to mutate inputs ( eg. performance. did you ever stop and wonder why eg. default JS sorting behaviour is modification in place? ). So if a kata specifically specifies ( and tests! ) this behaviour, you can have your doubts, but it makes a valid kata.
I fully agree side-effect-free programming has its advantages ( as well as its disadvantages, but you're not even mentioning those ). But single-mindedly forbidding valid language features in kata, or even kata about valid language features, is just closed-minded. Everything's a trade-off, including side-effect-free programming.
Yeah, that confused me for a while. I just directly followed the examples
^didn't knew about that. Thanks man.
very clever
It creates a local copy so that
sort()
doesn't mutate the input array.just print the given array and average and your answer in your solution, you will get to know all the test case
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This issue is completely valid - a static method, equivalent to (for example)
Arrays.sort
in Java ,would simply beArray.remove_
in JavaScript. Attaching to the prototype means the method is available on each instance and each instance only. It would be the equivalent of sorting arrays in Java in the following mannerThis is a suggestion.
"The problem is, you ether learned this lesson already, then this is trivial, or you do not know where the problem is. "
A lot of bug fixing is like that, obvious when you have seen it before, mindnumbingly frustating otherwise.
Thanks
Loading more items...