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.
thank you!)
"v" is unused, it is needed because by default first parameter is current element and second is index.
May someone explain me the use of 'v' in filter method here?
Oh, thanks. I just thought this would be O(6n).
It seems I need learn more about the time complexity.
Is this the Best Practices?
It runs the loop so many times, and that can be optimize.
Thank you)
Filter loops through every item in an array and 'v' is a placeholder/variable that represents the current item. 'v' can be any name you choose. Since this problem does not require using the current item, it serves no purpose. Many times you'll encounter a
_
variable when a function parameter is planned on being unused.Who can explain, what v it means?
It means your code returns
undefined
(if JS, probably you return nothing), while it must return a boolean.This comment is hidden because it contains spoiler information about the solution