Max Element In Array Javascript Length Function