For debugging, use console.log(). For DOM updates, use innerHTML or innerText.
JavaScript Tutorial
JavaScript Tutorial
JavaScript Asynchronous
JavaScript HTML DOM
Advertisement
Google AdSense Slot (LEADERBOARD)
Automated High-CTR Ad Rail • Set Publisher ID in config/adsense.php
Displaying Data
7 min read
•
Chapter 4 of 22
JS Output
JavaScript can "display" data in different ways: innerHTML, innerText, document.write(), window.alert(), and console.log().
Example
<!DOCTYPE html>
<html>
<body style="font-family:sans-serif;padding:20px;">
<button onclick="console.log('Logged to DevTools'); alert('Alert Popup Shown!');">Test Output Methods</button>
</body>
</html>
Try it Yourself >>
Opens live sandboxed code editor
Advertisement
Google AdSense Slot (IN-ARTICLE)
Automated High-CTR Ad Rail • Set Publisher ID in config/adsense.php
Community Q&A & Discussion
Verified
No questions yet. Be the first to start the discussion!