In: Computer Science
Pick a favorite JavaScript topic you learned from this course and present a lesson using a page or series of web pages that fully teaches someone who may be interested in learning about that topic, and create a mini website for your tutorial. You must make use of JavaScript code snippets to provide valid examples of proper syntax. Code examples with errors in them will not earn full credit. For your code snippets make use of this JavaScript-based syntax highlighter library. You must link to a page or provide working examples of what your tutorial is teaching. For example, if your tutorial is on displaying user output with JavaScript code, your tutorial should provide working in-browser examples of displaying user output. If your tutorial needs multiple pages to teach the concept provide a menu system that makes it easy to navigate to each page of the tutorial.
Topic- JavaScript Output
There are different ways to present Output in JavaScript. These are:
innerHTML: For accessing HTML element, we use document.getElementbyId(id). The innerHTML element specifies the content.
<!DOCTYPE HTML>
<html>
<body>
<h1>
Web Page 1
</h1>
<p>
This is a paragraph
</p>
<p id="demo">
</p>
<script>
document.getElementById("demo").innerHTML = helloo!!!
</script>
</body>
</html>
document.write() : All the existing html will be deleted after loading a document.
<!DOCTYPE html>
<html>
<body>
<h1>
Web Page 2
</h1>
<p>
This is a paragraph
</p>
<script>
document.write(helloooo!!!)
</script>
</body>
</html>
window.alert() : An alert box can be used to display data.
<!DOCTYPE html>
<html>
<body>
<h1>
Web Page 3
</h1>
<p>
This is a paragraph
</p>
<script>
window.alert(helllooo!!!)
</script>
</body>
</html>
console.log() : This ethod can be called in a browser to display content.
<!DOCTYPE html>
<html>
<body>
<h1>
Web Page 4
</h1>
<p>
This is a paragraph
</p>
<script>
console.log(helllooo!!!)
</script>
</body>
</html>