var canMakeArithmeticProgression = function(arr) {
let quickSort = function (arr) {
if (arr.length < 2) {
return arr;
}
let left = [];
let right = [];
let mid = Math.floor((arr.length - 1) / 2);
for (let i of arr) {
if(i < arr[mid]) {
left.push(i);
break;
}
right.push(i);
}
return quickSort(left).concat(arr[mid], quickSort(right))
}
let sortArr = quickSort(arr);
let diff = sortArr[1] - sortArr[0];
let i = 1;
while( i < sortArr.length - 1){
if(sortArr[i+1] !== sortArr[i] + diff){
return false;
}
i++
}
return true;
};
console.log(canMakeArithmeticProgression([1,3,3,4]));
console