Estimated Time: 1.5 hours
<aside>
❗ Welcome to CodeLab's article on JavaScript! Here, you'll learn the basics of the language and how to apply it in web development.
As always, you can follow along with the source code here.
</aside>
Prerequisites
HTML
CSS
Overview
What is JavaScript?
JavaScript is a programming language popular in both front and back-end web development. It's a dynamically typed, interpreted language that runs incredibly fast on modern web browsers.
Introduction to JavaScript
JavaScript Basics
https://www.youtube.com/watch?v=kccz9Go4yOA
Key Takeaways:
- JavaScript is an interpreted language, not compiled, so you won't catch every error without running your code.
- To run a JavaScript file, you'll first need to install Node. Then, navigate in your CLI to where your
.js file is stored, and type node fileName.js .
- To create a simple variable in JavaScript, you can use
const, let, or var. const is for constant variables.
- let is for blocked-scoped variables, while var is function-scoped - because it's generally better programming practice to only create variables where you'll need them, you should only use let.
- Note that there is no declaring of data types in JavaScript - you simply create your variable and assign it a value when the time comes.
- Objects in JavaScript are simply a collection of fields stored in a variable declared with one of the three aforementioned keywords - this structure is what is used to create the JSON object syntax, which you'll often hear it referred to as.
- In JavaScript, semicolons are optional; however, for consistency, you should still always use them.
JavaScript Functions
https://www.youtube.com/watch?v=ySZgjf_IpOM