var diagonalSum = function(mat) {
let answer = 0;
const arrLen = mat.length;
const arrHalf = Math.floor(arrLen/2);
for(let i = 0; i < arrLen; i++){
answer += mat[i][i] + mat[i][arrLen-1-i];
}
return arrLen % 2 === 1 ? answer - mat[arrHalf][arrHalf] : answer;
};