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.Oh! okay, I am a beginner btw. Can you give me any tip ?
This comment is hidden because it contains spoiler information about the solution
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
My code is working perfectly in console(in my pc) but when I am running a test here. It showing this in error "expected [ 1, 3, 2, 5, 3, 0 ] to deeply equal [ 0 ]". Can someone please help.