Reverse Javascript Array Length Function