other than that the values should be pushed correctly
No, because the push is outside the loop.
array.lenth is undefined and 0 < undefined is false, so your loop never runs and because the push is outside the loop, you're only pushing the first element to the new array.
This comment is hidden because it contains spoiler information about the solution
Thanks a lot Chrono, I didnt think of that.
Is
[1, 2, 2, 3]
sorted to you or not?This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
No, because the push is outside the loop.
array.lenth is undefined and 0 < undefined is false, so your loop never runs and because the push is outside the loop, you're only pushing the first element to the new array.
well array.lenth has a typo, it should be array.length, also, i=0; should be var i=0;
other than that the values should be pushed correctly
This comment is hidden because it contains spoiler information about the solution
thanks a lot Chrono79!
I didnt realize there was a spoiler content flag, ill be sure to use it from now on.
Wrong data type,
"true"
is a string, not a boolean. And mark your post as having spoiler content when it does.This comment is hidden because it contains spoiler information about the solution