JSFiddle - React, Tailwind, and code Playground

HTML

<dl>
  <dt>A</dt>
   <dd>A1</dd>
  <dt>B</dt>
   <dd>B1</dd>
   <dd>B2</dd>
</dl>

JavaScript

var res = [];

$("dt").each(function(idx) {
    var el = $(this),
        tmp = [el.text()];
    el.nextUntil("dt").each(function(idx) {
        tmp.push($(this).text());
    });
    res.push(tmp);
});

console.log(res);