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.
!arr
would be wrong too. Array is an Object and any object is true-ish.Because in JavaScript
[] == []
returns false - you cannot directly compare arrays. I suggesting reading this or this for information why. If you are checking an empty array, I suggest using Boolean, e.g. if !arr or arr.length==0.Edit: Fuck, jinx beat me to it again :P
Wrong:
arr==[]
Right:
arr.length==0
My code:
function isIntArray(arr) {
if(arr == []) {
return true;
}
}
is returning "undefined" on the first test - how??