Infosys Interview Question

How to sort an array in JavaScript and to calculate it’s length.