Javascript Function Creation Reverse an array
let reverseArray = function(x,indx,str) { return indx == 0 ? str : reverseArray(x,--indx,(str+= " " + x[indx]));; } let arr = new Array('apple','orange','peach','lime'); let str = reverseArray(arr,arr.length,""); console.log(str);/* ww w. j av a2 s . c o m*/ let arr2 = ['car','boat','sun','computer']; str = reverseArray(arr2,arr2.length,""); console.log(str);