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.
Well done, I like katas about object oriented programming in general.
You did a blind copy / paste there didn't you? I didn't completely type out the new version though - read it carefully ..
Thank you for suggestion
I changed the description
Not gonna argue. But I'd rather do a bunch of existing katas, then have another one with multiple tasks glued into one (because "such a great idea" to have a kata asking you to add an iterator to an existing class when we have a few katas specifically about extending a class, and a few katas specifically about iterators).
The easiest (and the most reasonable?) way to solve the task is to "convert" the object into a
keys/entriesarray, and iterate over it, so...More kata combine functionality from other kata. Let's agree to disagree here.
A key-value pair absolutely is a value. But an
Objectvalue is absolutely not anArrayvalue. There's not a worth 2 kyu difference, but there is a difference. If you don't want to understand this, let's agree to disagree here.Extending a built-in type is a bad practiceI don't see how key-value pair is not a value (but this note is pointless in this discussion).
( dammit. it did post. )
( deleted )
There may be existing kata that ask to implement an iterator/generator, but the task in this kata specifically is extending
Object.prototypewith an iterator. If you consider this kata a duplicate, please point out what you consider to be the original(s). Also, there are no array values, there only are object key/value-pairs.I still think this kata deserves its own lease on life. Higher ratings would help there however, and that means much better testing to start with, otherwise it may deserve a life but throw it away itself. ( My own rating still is
Not Muchbecause of the wholly inadequate testing. )Even then we already have katas asking you to implement an iterator/generator in JS, so I don't see a point in another kata which asks you to simply
yieldthe array values.I disagree.
There are more kata that are solveable with the same code, but where the simpler of the two is also solveable with simpler code. That does not make them duplicates. In that case, the reverse should be true as well, and it isn't here.
Constructed
Objects and "plain"Objects are indistinguisable. Possibly you mean "Objects constructed from an object literal"?"Bypassing" seems to be the wrong term here, and what you mean by "circumvent" is entirely unclear.
Also, it is preferable to specify expected values instead of relying on an example, which asks us to read your mind ( granted, your thought are pretty clear here, but the general principle holds ).
May I suggest "
Most
Objects ( excludingArrays and the like here ) are .. (). We can rectify this for our purposes by extending theObjectprototype with a custom iterator.Our iterator should produce successive ( in insertion order ) values of
[ key, value ]." ?
All of the random tests have objects of size
1. Is this intentional, or was that1meant forallowNested?( This is why you await confirmation the issue is actually solved before closing them. )
( Your kata idea has nothing to do with it being a duplicate or not though. )
The kata is still a duplicate. The fact that you've solved both of your katas with the same code only proves the point.
I corrected and added random tests
Loading more items...