This glossary provides brief explanations of common terms and concepts related to JavaScript.
A data structure that stores a collection of elements, typically of the same type, accessible by an index.
A concise way to write anonymous function expressions in JavaScript using the =>
syntax.
A pair of keywords used to work with asynchronous code in a more synchronous-like manner, introduced in ES8 (ECMAScript 2017).
A set of rules and protocols that allows different software applications to communicate with each other.
A technique for creating interactive web applications by exchanging data with a server asynchronously without reloading the page.
Actual values passed to the function when it is invoked.
An operator used to assign a value to a variable.
A function that operates on arrays to perform tasks like adding, removing, or transforming elements.
Operators used to perform arithmetic operations, such as addition (+), subtraction (-), multiplication (*), division (/), and modulus (%).
Keywords used to specify the accessibility of class members in object-oriented programming languages.
The process of hiding the implementation details and showing only the essential features of an object or function.
A set of step-by-step instructions for solving a problem or completing a task, often expressed as pseudocode or in a programming language.
The process of verifying the identity of a user or system, often used in web applications to restrict access to certain resources.
The process of creating the illusion of motion by displaying a series of images or frames in rapid succession.
A specific URL where an API can be accessed and interacted with.
The position of an element in an array, starting from zero for the first element.
A popular library for validating JSON data against JSON Schema definitions.
A class that cannot be instantiated and is typically used as a base class for other classes to inherit from.
A data type that can have one of two values: true or false.
A keyword used to exit a loop prematurely, skipping the remaining iterations.
Refers to operators that perform bitwise operations on binary representations of numbers.
A group of statements enclosed in curly braces { }, often used to define scope in JavaScript.
The scope of variables defined within a block, such as within a function or loop.
A statement used to exit a loop or switch statement prematurely.
A set of objects provided by web browsers, which expose the browser functionality to JavaScript.
A method used to create a new function that, when called, has a specified 'this' value and optional initial arguments.
A temporary storage location used to hold data during input and output operations.
A JavaScript compiler that transforms modern JavaScript code into backward-compatible versions for older browsers.
A sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
A closure is a combination of a function and the lexical environment within which that function was declared. This allows the function to retain access to variables from its containing scope even after the scope has closed.
A callback function, often referred to simply as a callback, is a function that is passed as an argument to another function and is executed after a particular event or operation has occurred.
A syntax for unpacking values from arrays or properties from objects into distinct variables.
// Array Destructuring
const [a, b] = [1, 2];
console.log(a); // Outputs: 1
console.log(b); // Outputs: 2
// Object Destructuring
const { x, y } = { x: 10, y: 20 };
console.log(x); // Outputs: 10
console.log(y); // Outputs: 20
The Document Object Model (DOM) is a programming interface for web documents. It represents the structure of HTML and XML documents as a tree-like structure, allowing programs to dynamically access and manipulate the content, structure, and style of web documents.
An event is a signal that indicates that a specific action has occurred. In JavaScript, events can be triggered by user interactions (such as clicking a button or typing on a keyboard) or by other parts of the program (such as loading a web page or receiving data from a server).
An event listener is a function that listens for a specific event to occur and executes a specified piece of code (the event handler) in response to that event.
Event delegation is a technique in JavaScript where you attach an event listener to a parent element instead of attaching it to the individual child elements. When an event occurs on a child element, it "bubbles" up through the DOM hierarchy to the parent element. The event listener on the parent element can then check the event.target property to determine which child element triggered the event.
Event loop is a fundamental conecpt in JavaScript that allows for asynchronous programmind despite Javascrpt being a single-threaded.
A function is a block of reusable code that performs a specific task or calculates a value. Functions allow you to organize code into logical units, making it easier to understand, debug, and maintain.
An Immediately Invoked Function Expression (IIFE) is a JavaScript design pattern that involves defining and immediately executing a function. This pattern is often used to create a private scope for variables and functions, preventing them from polluting the global namespace.
A way to create a new object or class that uses properties and methods from an existing object or class.
// Parent class
class Animal {
speak() {
console.log('Animal makes a sound.');
}
}
// Child class inherits from Animal
class Dog extends Animal {
bark() {
console.log('Dog barks.');
}
}
const dog = new Dog();
dog.speak(); // Outputs: Animal makes a sound.
dog.bark(); // Outputs: Dog barks.
Hoisting in JavaScript refers to the process where variable and function declarations are moved to the top of their containing scope during the compilation phase. This means you can use variables and functions before they are declared in the code. For variables declared with var, the declaration is hoisted, but the initialization is not. For variables declared with let and const, the declaration is hoisted, but they are not initialized until the code execution reaches the declaration. This results in a "temporal dead zone" where accessing the variable before its declaration will throw a ReferenceError.
A collection of key-value pairs where both keys and values can be of any type. Keys are unique and are maintained in insertion order.
null is a primitive value, it represents the intentional absence of any value. It's often used to explicitly indicate that a variable or object property does not have a value.
A Promise is an object that represents the eventual completion (or failure) of an asynchronous operation and its resulting value. Promises provide a cleaner and more flexible way to work with asynchronous code compared to traditional callback-based approaches.
Variables listed as part of the function definition.
In JavaScript, prototypal inheritance allows objects to inherit properties and methods from other objects.
A collection of unique values where each value can only occur once. Values are maintained in insertion order.
Statements are syntax constructs and commands that perform actions.
A string literal allowing embedded expressions, multi-line strings, and variable interpolation using backticks (` `).
undefined is a primitive value in JavaScript that is automatically assigned to variables that have not been initialized or to object properties that do not exist.
A variable is a named storage location that holds data. In JavaScript, variables can store various types of data, including numbers, strings, objects, and functions. Variables can be declared using the var
, let
, or const
keywords.
Compares two values for equality after converting both to a common type.
Compares two values for equality without type conversion; both type and value must match.
A shorthand for if-else
statements, returning one value if a condition is true and another if false.
Returns true if both operands are true; otherwise, returns false.
Inverts the truthiness of the operand; true becomes false, and false becomes true.