The Document interface has a method, createComment(), which does exactly as the name indicate; creating an HTML comment. We can then insert that comment wherever we want on the page. Admittedly, I can't think of a use case for that, but it's good to know it's there.

let HTMLComment = document.createComment('some comment');

document.body.appendChild(HTMLComment);

The createComment() will create a comment object, and we can log the text to the console using the textContent property on that object. In fact, we can do all sorts of things that we can do with any HTML element on that object.

console.log(HTMLComment.textContent);