Lesson 1: Introduction to JavaScript
Introduction
- Differences between HTML, CSS and Javascript
- Printing output to the screen
- Commenting out code
JavaScript is the programming language of the web. It is used across multiple different platforms in gaming, business applications, web APIs, and so on. When used in conjunction with HTML, you can create professional and functional web pages with a large variety of features.
Differences between HTML, CSS and Javascript
- HTML defines the structure of a website.
- CSS is used to provide look/style to a website.
- Javascript is used to make a website interactive.
Printing
Log any message that you want to the console, for example, your name. It’s a good way to get used to editing JavaScript code in the trinket.io window.
Example:
Console.log("Hello,World");
Commenting
Place // at the start of a line to make single line comments.
For comments that span over multiple lines, begin with /* and end with */. This is useful for leaving small comments above your code explaining its function and your thought process. This will help you when you begin to debug and edit your code later on.
Try It!
Comment out the two lines in the index.js file:
Further Reading
Related Games