javascript middle of array
snippet in javascript

javascript middle of array

user3347

var arr = [1,2,3,4,5];

return arr[Math.floor(arr.length/2)];