JavaScript Output
JavaScript can display data in different ways.
Table of Contents
JavaScript has four ways to display output. The most useful and common is innerHTML โ it lets you update any element on the page without a full reload.
Try It โ Output Methods Compared
Preview
Output Methods Compared
| Method | Where Output Goes | Best For |
|---|---|---|
innerHTML | Inside an HTML element | Displaying HTML content |
textContent | Inside an element (text only) | Safe text updates |
document.write() | Directly in HTML stream | Quick testing only |
window.alert() | Browser popup | Simple alerts |
console.log() | Browser DevTools (F12) | Debugging |
Tip: Open your browserโs DevTools (press F12 โ Console tab) to see the
console.log()output from the JS editor!