var arr = new Array(); arr[0] = "george"; arr[1] = "john"; arr[2] = "thomas"; arr[3] = "james"; arr[4] = "adrew"; arr[5] = "martin"; arr.sort(); // sort the array in ascending order console.log(arr); // output: ["adrew", "george", "james", "john", "martin", "thomas"]