Array Basics
var fruits = "Banana,Orange,Apple,Mango";
var arrFruit = ["Banana", "Orange", "Apple", "Mango"];
// add to array
arrFruit.push("Kiwi");
// convert string to array
var arr = fruits.split(',');
// convert array to string
var str = arrFruit.toString();
Array Sort
String Sort (alphabetical)
var food = ["Banana", "Chocalte", "Apple", "Del Taco"];
food.sort();
console.log(food) // Array [ "Apple", "Banana", "Chocalte", "Del Taco" ]
//reverse sort
fruits.reverse();
Number Sort
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return a - b});
//reverse
var points = [40, 100, 1, 5, 25, 10];
points.sort(function(a, b){return b - a});