JS TutorialLesson 3Free preview
JS Output
This lesson is part of JavaScript · All levels
Summary
JavaScript provides several ways to display results, ranging from console.log() for debugging to document.write() that writes directly to the page. Results can also be displayed by changing the content of HTML elements via innerHTML or textContent, as well as simple dialogs such as alert, confirm, and prompt. For everyday development, console.log() is the most common choice because it does not interfere with users.
Key points
- Console.log() displays values in the developer tools browser
- Document.write() writes directly to the HTML document stream (and hits the page when called upon after it is loaded)
- InnerHTML and textContent update the content of the elements on the page
- Alert(), confirm(), and prompt() displayed blocking dialogues
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.