JavaScript Introduction
Overview
JavaScript is a popular, well-supported programming language that is used to create interactive and dynamic web pages and applications as well as mobile, and desktop applications. It is a high-level, interpreted language that is designed to run in web browsers. JavaScript can also be used on the server-side with the help of technologies like Node.js.
In this class you will learn how to apply your prerequisite, programming knowledge to the web using the JavaScript programming language. JavaScript uses the same principled concepts and common control structures as any other programming language.
JavaScript is one of the three, core technologies of web frontend development.The other two are HyperText Markup Language (HTML) and Cascading Styles Sheets (CSS).
- HTML defines the structure and meaning of a page.
- CSS defines the style or presentation of a page.
- JavaScript handles the behavior based upon user interaction and other events.
Associated Course Learning Outcomes
- Demonstrate proficiency with JavaScript language syntax.
- Use JavaScript to respond to events and dynamically modify HTML.
Activity Instructions
Answer the following questions using this resource What is JavaScript? - MDN Web Docs or use your own research.
You are encouraged to responsibly use contemporary language models and generative AI tools like ChatGPT, Gemini, Bard, Bing Chat, Meta AI, etc. Learn to cautiously use these tools as an on demand tutor to help define concepts, clarify questions, and to provide guidance.
- What is the file extension used for JavaScript files?
Check Your Understanding
.js
- How is JavaScript included on web pages?
Check Your Understanding
A
<script>
HTML tag is used to include JavaScript code in an HTML like this:
The<script></script>
script
tag can be used anywhere on the page.
This course uses external script files and places the source reference in thehead
of the HTML document. - What standard way does this course reference JavaScript?
- Use external JavaScript files.
- Place the .js JavaScript files in the
scripts
subfolder. - Reference the script file in the
head
of the HTML document. - Use the
defer
attribute to ensure that the HTML loads first in order to interact with HTML.
Check Your Understanding
<head> ... <script src="scripts/myscripts.js" defer></script> </head>
Common Misconceptions and Language Issues
- JavaScript is not the same programming language as the Java programming language. They are two different languages with different syntax and purposes.
-
The plural form of "code" in programming is just "code", not "codes".
Example: "Please review my code." or "Please review my program". Not "Please review my codes." - JavaScript is not just for the browser and client-side scripting. With the introduction of server-side frameworks like Node.js, JavaScript can now be used for server-side development as well. JavaScript is a mature language and has become more powerful and versatile over time.