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.
Both points seem fixed some time ago.
Here why we need to include null condition
Pretty nice basic kata.
Good practice. This is definitly helping me with returns.
Bob the Lantern shining a light. Thanks for the info, I do indeed appreciate it!
There are a lot of kata that don't explicitly say "You must return such and such value." Is it bad that they don't have that in the description? Maybe? But I think in most cases, like here, you can infer exactly what the kata wants you to return.
This comment is hidden because it contains spoiler information about the solution
I am pretty sure that sheep plural is just sheep and not sheeps
This usually works better for small arrays. Say you have a larger one - the inside test if (element == true) takes more time than a manually written "if (element)" test.
JS Web Bro per se
Write a function that takes an array as an argument. The function should return the number of
truevalues in the array. The function must be namedcountSheepsHow do I do this on Javascript. I'm taking computer science with CodeHs and this is nothing like what we've started. I need more instructions on what it's asking of me.
Author, please fix the task description: it does not mention that the array can contain None.
This was a nice warm up, but I can't help but notice you warned that we should watch for invalid input like null or undefined, but this wasn't part of the solution. I know that's not really possible considering the list will break if they're not all bools, but I added extra code to test for this situation (foolishly so, don't judge my solutions it's early and my first test in years) and it wasn't necessary at all. A bit of an irrelevant, confusing line imo.
You can open the trainer again and look at the "past solutions" tab on the left. You can also open the solutions page and filter for "Mine" on the left side of the page. You can also click on the "View solution" link right under the comments that you make (The language has to be set correctly at the top of the page for this).
Loading more items...