мне нужно создать объект в котором должно быть 10 div внутри него ul а внутри него 10 li

let y = 0,
  j = 0,
  i = 0,
  boxMultiplication = [];
console.log(boxMultiplication);
divd()

function divd() {

  if (answer.length > i) {
    console.log(1);
    divs()
  }
}

function divs() {
  if (i == y) {
    boxMultiplication[`div ${y}`] = ['ul'];
    boxMultiplication[`div ${j}`]['ul'] = ['li'];

    j = y;
    y += 10;
  }
  boxMultiplication[`div ${j}`]['ul']['li'] = `${i}`;
  i++
  divd()
}

console.log(boxMultiplication);


Ответы (1 шт):

Автор решения: ᅠhᅠ
const nodes = new Array(10).fill({
  type: 'div',
  children: {
    type: 'ul',
    children: new Array(10).fill({
      type: 'li',
      children: 'data'
    })
  }
})
→ Ссылка