High-level programming language.
JavaScript is a high-level, interpreted programming language that is primarily used to enhance web pages to provide for a more user-friendly experience. It is a key pillar of modern web development and forms the foundation for frameworks like React. This unit will cover the basics and fundamentals of JavaScript.
JavaScript was initially created to “make web pages alive”. Today, JavaScript can execute not only in the browser, but also on the server, or actually on any device where exists a special program called the JavaScript engine.
In JavaScript, there are several types of data that we can work with:
Variables are "containers" for storing data values. In JavaScript, there are three types of variables you can declare:
JavaScript includes arithmetic operators like addition (+), subtraction (-), multiplication (*), and division (/). It also includes the modulus operator (%) to find the remainder of division and the increment (++) and decrement (--) operators.
Control flow is the order in which the computer executes statements in a script. Control flow statements in JavaScript include:
A JavaScript function is a block of code designed to perform a particular task. Functions are executed when they are called. This is known as invoking a function. Functions can be defined using function declaration or function expression.
Scope determines the accessibility or visibility of variables, functions, and objects in some particular part of your code during runtime. In other words, scope controls the visibility and lifetimes of variables and parameters.
An array is a special variable, which can hold more than one value at a time. Arrays are list-like objects whose prototype has methods to perform traversal and mutation operations.
Objects in JavaScript, just as in many other programming languages, can be compared to objects in real life. In JavaScript, an object is a standalone entity, with properties and type.
ES6, also known as ECMAScript 2015, introduced many changes to JavaScript. Some of the most notable features include:
By the end of this unit, you should have a solid understanding of the basics of JavaScript, which will serve as a foundation for the rest of the course.