[50, 41, 32, 23, 14, 5, -4, 5, 14, 23, 32, 41, 50]
I did it but it’s returns undefined
!!
let arr = [];
let flag = false;
const recursionPattern = (int1, int2) => {
if (int1 < 0) {
flag = true;
}
arr.push(int1);
if (arr[0] == arr[arr.length - 1] && arr.length > 1) return arr;
else {
if (flag) recursionPattern(int1 + int2, int2);
else recursionPattern(int1 - int2, int2);
}
};