Summary
JavaScript is a programming language that lets you add interactivity to a web page.
Details
JavaScript is a programming language for the web. It is used to add interactivity to a web page. It can be used to add, modify, or remove elements on the web page, perform calculations, and retrieve data from other services using APIs.
Here’s a sample of some JavaScript code:
// Create new element
const newParagraph = document.createElement('p');
// Add text content to new element
newParagraph.textContent = 'Test paragraph';
// Select parent element
const parentDiv = document.querySelector('div');
// Append new element to parent element
parentDiv.appendChild(newParagraph);
This code is adding a new paragraph element to the page. Here’s a demo showing the code in action:
JavaScript is usually the third language a web developer learns, after HTML and CSS.
Main concepts
Here are some of the main concepts you’ll learn in this course:
- Variables
- Constants
- Data types
- Conditional statements
- Loops
- Functions
- DOM
Please note, there are a lot of concepts you have to learn before you actually start learning how to modify web pages with JavaScript. You won’t start modifying web pages with JavaScript until you get to the DOM module.
Exercises
You can download exercises to go along with these tutorials on our JavaScript exercises GitHub repo. Just click the green Code button in the corner and click the Download ZIP option.
Each module has a folder. Inside each module folder is a folder for each lesson. The lesson folders usually contain files already where you can put your code, although occassionally you will be asked to create files on your own.
NOTE: You can ignore the instructions included in the folders. The instructions are now listed directly in the lessons.
References
What is JavaScript? on MDN