function printNumbers(arr) {
let maxDepth = 0;
let value = 0;
 
function walk(depthArr, depth) {
for (let i = 0; i < depthArr.length; i++) {
if (Array.isArray(depthArr[i])) {
walk(depthArr[i], depth + 1);
} else {
if (depth > maxDepth) {
value = depthArr[i];
depth = depth;
} else if (depth === depth && depthArr[i] > value) {
depth = depth;
}
}
}
}
 
walk(arr, 0);
 
return value;
}
 
console.log(printNumbers([1, [[20, 1, [101]], 2], [[-2], [[102, 100]]]]));
 
Click Run to execute JavaScript.
Code runs in an isolated environment.