let a15 = [
[],
[1,0],
[1,0,0,0],
[3,4,5,6,7,8],
[1,2]
];
let maxString = a15[0].length;
function f15() {
for (let i = 1; i <a15.length;i++)
if(a15[i].length> maxString){
maxString = a15[i].length;
document.querySelector('.out-15').innerHTML = maxString ;
}
document.querySelector('.b-15').onclick = f15;
где ошибка?
const maxlen = Math.max(...arr.map(n => n.length));
// или
const maxlen = arr.reduce((max, { length: n }) => max > n ? max : n, -Infinity);