Question

In: Computer Science

Pick a favorite JavaScript topic you learned from this course and present a lesson using a...

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.

Solutions

Expert Solution

Topic- JavaScript Output

There are different ways to present Output in JavaScript. These are:

  • innerHTML- HTML element
  • document.write()- HTML output
  • window.alert() - alert box
  • console.log() - browser console

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>

Related Solutions

Present and discuss a topic that you are interested in researching for this course: Global shortage...
Present and discuss a topic that you are interested in researching for this course: Global shortage of personal protective equipment (PPE) Explain why this topic interests you: Provide a brief background of the topic and speculate on arguments you could pose or problems you could solve: Additionally, draft a potential problem statement:
In 2 paragraphs please tell me what you have learned from this course. The course is...
In 2 paragraphs please tell me what you have learned from this course. The course is Managed Care Policies and Implications.
Lesson learned / Recommendations from "Women in management positions or in positions with responsibility. It is...
Lesson learned / Recommendations from "Women in management positions or in positions with responsibility. It is of no shock that the history of women trying to gain more advancement in organizations is a challenge, no matter the country. While there is some progress such as countries like ours, around the world women still have very restrictive roles in businesses such as in China and in Japan. Challenges includes things such as harassment and a culture that does not embrace women...
"why company management matters". In an essay refer to lesson learned form gustav Schulenburg topic regarding...
"why company management matters". In an essay refer to lesson learned form gustav Schulenburg topic regarding the implementation of Corporate Govenance.
what are the lessons learned from sociology course?
what are the lessons learned from sociology course?
Pick a topic from the visual system and discuss it .
Pick a topic from the visual system and discuss it .
(COURSE) MKTG1370 Summarize what you have learned in this course.
(COURSE) MKTG1370 Summarize what you have learned in this course.
Discuss"Is the Customer Always Right?" (COURSE) MKTG1160 Summarize what you have learned from this course and...
Discuss"Is the Customer Always Right?" (COURSE) MKTG1160 Summarize what you have learned from this course and how you will apply it in the future.
What is a good lesson that can be learned from why people should not fight?
What is a good lesson that can be learned from why people should not fight?
3. The lesson we learned from the circular flow model was the fact that the GDP...
3. The lesson we learned from the circular flow model was the fact that the GDP can be measured in two equivalent ways: the expenditure approach and the incomes approach. Use the following data to answer the questions below. National Income Accounts: Net investment ​​​110​​Income earned but not received​​60 Depreciation​​​ 30​​Income received but not earned​​70 Exports​​​​ 50​​Personal income taxes​​​50 Imports​​​​ 30​​Employee Compensation​ 455 Government Purchases​​150​​Corporate profits​​ 60 Consumption​​​400​​Rental income 20 Indirect business taxes​​ 35 Net Interest 30 Proprietors’ income​​ 40​​Net...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT