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.
If the execution in your
if
statement is a return, you don't need anelse
block after it, because the function will not continue to execute once it's returned.And with the spread operator, you can now simplify the use of Math.min and Math.max to
Math.min(...array)
andMath.max(...array)
, respectively.This comment is hidden because it contains spoiler information about the solution
That's your code's problem. Don't use global vars, they keep their value between tests. Read this: https://docs.codewars.com/training/troubleshooting/#works-but-no