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.
Good one with the prototype. but if the object will be created with the class, the prototype is created automatically.
I did it almost the same. Yours is nicer.
I'm sure current tests would pass without it but consider the case:
iterable = [undefined, undefined, 'a', 'b', 'c']
That method didn't exist in earlier JS versions.
just the zen of python ;)
but the point I was focusing is the build-in filter
Enveloping a function into a class for no particular reason sure makes a lot of sense ;)
none of you read the title!
where is that filter???
checkout my solution!
this solution does also use a foor-loop
beatiful
just for arguments sake, i wouldnt make human an interface since men and women share attributes, not just behaviors
This comment is hidden because it contains spoiler information about the solution
Thank you very much for your reply ;)
It's a bitwise OR operator which in this case (against 0) essentially cuts of all non integers. Here it's used as a somewhat crude and hacky way to avoid Math.floor() or parseInt().
My advise would be to be careful using it in your projects. The | 0 is easily overlooked and can leave your future you searching forever where your math doesn't add up. Math.floor() does a better job at being self-explanatory. Since the example above is very short, the | 0 doesn't hurt for the simple purpose it serves.
Also look at stanleyvarga's comment. He also makes a solid point not to use it everywhere.
What means this "|" in Javascript ?
But it makes it easier to read.
Loading more items...