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.
What the map is doing in this example is taking the current element (x), the index of the current element (i), and the array that .map was called upon (arr) - the x, i, and arr are just variables that you can name whatever you wish but they will always reprsent the element, index, array in that order. Sometimes you only want the array when using a map, but the only way to do that is to include the element and index regardless.
However if you only need the element you can write something as simply as .map((x) => x ** num), ignoring the index and array.
You can read more about it on the MDN here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
LOOL! My exact thoughts! Very efficent!
This comment is hidden because it contains spoiler information about the solution
WOW, this is so simple and I love it. Gonna have to write this one down.
damn I gotta put this in anki so I can learn to code better, my solution seems inneficient
the map() method can take in several parameters, .map(element, index, array), in this case c is the element and i is the index. You can call them anything you'd like rather than c or i, but they always represent the same thing in .map()
The Mozilla MDN has a great page on it so you can get a better feel for it. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
In Javascript, the tests do not allow for "private" variables (such as using a _ or #) so nobody can unintentionally alter the class. Seems suitable to add to a 7kyu.
This one was pretty fun though!
Genuinely genius, I feel silly for mine now! lmao
That is a problem with your code, not a kata issue. Read the error message, rethink the order you use to do things in your code.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution