Note: if the target table already has a <thead> then calling this method on the table won’t create another header anymore! Instead, it will just return a reference from that <thead>.
Also, you can use the deleteTHead() method to delete a <thead> from a table.
Note: when creating a <thead> element, you must also add one or more rows to it as well. To do this, you can use the insertRow() method.
createTHead() Method Syntax:
createTHead() Method Parameter
The method does not take an argument.
createTHead() Method Return Value
If the target table already has a <thead> element, then calling this method will return a reference from that element.
Otherwise, if there’s no <thead> element, the return value will be a reference to the new <thead> that is created.
Note that here because there’s a <thead> element already on this table, calling the `createTHead()` method will return just a reference to this element instead of creating a new one.