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.
Refrain from using global variables
Anyways 'Looks like you've solved it'
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 comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
"A higher order function is any function that takes a function as a parameter or returns a function as its result." These HOCs allow us to abstract some operations that are being performed repeatedly (in this kata, we want to multiply each index's value by two). Instead of, for example, writing a
for loop
, we can usemap
, a classic example of an HOC.map
takes an array and a function as arguments, which then uses this function to transform each item in the array, returning a new array with the transformed data. We like that it returns a new array because we want to avoid mutating any data. HOC's can do more than just manipulate array, for example,Function.prototype.bind
is another HOC in JavaScript. Just keep practicing, find really good examples of what it is that you don't understand, and try to find the meaning in them and why they're useful. These things don't come naturally for everyone, and it took me a while to understand and appreciate some concepts of programming until I had real life use cases for them.Sources:
That's no kata bug, your code doesn't work, why don't you read the instructions again? I've even added a test to the sample tests.
Depending on the input, your code returns a number with more than one digit.
Make sure to understand where JavaScript came from before you dive into some of the newer stuff :)
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 comment is hidden because it contains spoiler information about the solution