map:
var oldArray = [1,2,3,4,5];var newArray = oldArray.map(function(val){ return val +=3;//return [4,5,6,7,8]});
reduce:
var array = [4,5,6,7,8];var singleVar = 0;singleVar = array.reduce(function(pre,cur){ return pre+cur;//return 4+5+6+7=8+9=30});
filter:
var oldArr = [1,2,3,4,5,6,7,8,9,10];var newArr = oldArr.filter(function(val){ return val<6;//return [1,2,3,4,5]});
sort:
var arr = [1,12,21,3];array.sort(function(a,b){ return a-b;//from small to big});
reverse:
var arr= [1,2,3,4,5,6,7];var newArr = [];newArr = arr.reverse();//return [7,6,5,4,3,2,1]
concat:
var oldArr = [1,2,3];var newArr = [];var concatMe = [4,5,6];newArr = oldArr.concat(concatMe);//return [1,2,3,4,5,6]
split:
var String = "Split me into an array";var array =[];array = string.split(" ");//return ["Split","me","into","an","array"]
join:
var joinMe = ["Split","me","into","an","array"];var joinedString ="";joinedString = joinMe.join(" ");