how to find the middle element of an array in javascript code example
Example 1: javascript middle of array
var arr = [1,2,3,4,5];
return arr[Math.floor(arr.length/2)];
Example 2: javascript get middle of array
var value = arr[arr.length / 2 | 0];