• Custom User Avatar

    Is [1, 2, 2, 3] sorted to you or not?

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    Wrong data type, "true" is a string, not a boolean. And mark your post as having spoiler content when it does.