To write text to a webpage in JavaScript, you use document.write() which outputs content to the document. Option A is just a string literal, option C uses response.write() which is server-side, and option D is just a string without writing it to the document.