appendChild recursive javascript

<div>
  <div>
    <div>
      <div>
      </div>
    </div>
  </div>
<div>

const div = document.createElement('div');
const div1 = document.createElement('div');
const div2 = document.createElement('div');
const div3 = document.createElement('div');

div1.appendChild(div2);
div2.appendChild(div3);
div.appendChild(div);

I need a recursive function where I can create multiple divs inside another div

Where I don’t have to do it manually