this will always return false. isOdd() returns a Number, not a Boolean, and === does not perform type conversion.
mistake 2: Array.prototype.every() (and its counterpart some()) are evaluated lazyly: they break out of the loop as soon as they find a value that fails/passes the predicate, respectively.
This is so boring that i can't use object. And why is function in global scope after i use toString() in my object local scope is undefined? I guess problem is because function name _isprivateValue.
Jesus. I doubt just anyone else can compete with you to name at this level. Please name more readily. BTW I guess your solution and mine is equivalent.
mistake 1:
this will always return
false
.isOdd()
returns aNumber
, not aBoolean
, and===
does not perform type conversion.mistake 2:
Array.prototype.every()
(and its counterpartsome()
) are evaluated lazyly: they break out of the loop as soon as they find a value that fails/passes the predicate, respectively.both fixed
This comment is hidden because it contains spoiler information about the solution
I got it too
This comment is hidden because it contains spoiler information about the solution
Love your solution dagolinuxoid!
+1 don't mutate original array
This is so boring that i can't use object. And why is function in global scope after i use toString() in my object local scope is undefined? I guess problem is because function name _isprivateValue.
Jesus. I doubt just anyone else can compete with you to name at this level. Please name more readily. BTW I guess your solution and mine is equivalent.
And why does that matter? In this case, his algorithm is still O(n).
If there is equality, it's a "touch", not a "collision".
If I log out the input array after the method has run, I get the same as before, i.e. the input is not changed.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...