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.
The passed-in argument is always a number, so that cannot happen.
Case 2 makes the assumption that the API is configured properly to only accept expected input. From a cybersecurity perspective, even this is a bad idea.
eval()
should never be used in code that can be used by anyone aside from the author.There's always a tryhard for everything lol
because it slices out the min and max so the sum will be 0 if there are two or less elements in the array.
you are thinking of
exec
that does not return anythingThis comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This is cool I didn't know you could do that.
same
HATE RETURN
Good one :D
because despite having its dangers, the solution is beautiful to see, in the context of codewars, this type of solution comes out ahead... multiple 'ifs' are sometimes not very elegant..
This comment is hidden because it contains spoiler information about the solution
Why did I not think of this...
convert value1 and value 2 to strings first. Your code doesn't evaluate the values of value1 and value2. Say value1 = 1 and value2 = 3, your code is trying to evaluate value1 + value2 whereas it should be evaluating 1 + 3.
Loading more items...