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.
TODO:
LUL
This is so refreshing coming from Javascript.
For a newbie like me it means a lot. Thank you, Anthony.
This solution is - Chef's kiss - beautiful
This is the answer I needed.
Nice one!
Or you could just use a.localeCompare(b) instead of trying to find the index.Misread that.I'd say the best say is
[...'abcdefghijklmnopqrstuvwxyz']
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
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.Nice use of recursion. This inspires me to practice it more.
Would it be good practice to convert to a number if you plan on working with TypeScript or if you don't want type-coersion related bugs in your code?
When your employer pays you in peanuts...
This comment is hidden because it contains spoiler information about the solution
Loading more items...