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 array = $('dl dt').map(function() {
      // Get the ['A1'] and ['B1', 'B2']
       var items = $(this).nextUntil('dt', 'dd').map(function() {
        return $(this).text();
      }).get();
      
      // Prepend the dt's value
      items.unshift($(this).text());

      // Needs to be wrapped in a second array so that .map() doesn't flatten.
      return [ items ];
    }).get();

    console.log(array);