The HTMLTableElement.createCaption() method returns the caption element associated with a given table.
HTMLTableElement.createCaption()
MDN Reference