# JavaScript in 30 Words > Short JavaScript definitions and code examples for beginners and interview preparation. An English-language reference covering 40 JavaScript concepts. Each linked HTML page contains the definition, a selectable code example, expected output, and an MDN reference. This content is readable without JavaScript or an AI connection. ## Overview - [All JavaScript concepts](https://www.javascriptin30words.com/concepts/): Browse the complete reference. ## Fundamentals - [Variables](https://www.javascriptin30words.com/javascript-variables/): Variables can be denoted with the keywords let or const. The accepted convention is to use const as much as possible, and let when the variable is likely to be reassigned - [Arrays](https://www.javascriptin30words.com/javascript-arrays/): Arrays keep a list of values in order. Use an index to pick an item, starting at zero for the first one. - [Objects](https://www.javascriptin30words.com/javascript-objects/): Objects keep related information together as named properties. A learner object might hold a name, a score, and a method for updating that score. - [Functions](https://www.javascriptin30words.com/javascript-functions/): Functions in JavaScript consist of the function keyword followed by the name of the function, a list of parameters and statements that define the function. - [Function Expressions](https://www.javascriptin30words.com/javascript-function-expressions/): Function expressions load only when the interpreter reaches that line of code. They're not hoisted, allowing them to retain a copy of the local variables from the scope where they were defined. They do not pollute the global scope. - [Operators](https://www.javascriptin30words.com/javascript-operators/): + Addition - Subtraction \* Multiply / Divide % Modulus ++ Increment -- Decrement - [Comparisons](https://www.javascriptin30words.com/javascript-comparisons/): == Equal to === Equal to Value and Type != Not Equal !== Not Equal in Value or Type \> Greater \< Smaller - [If and Else](https://www.javascriptin30words.com/javascript-if-else/): An if statement checks a condition and runs code when it passes. Add else to say what should happen when it doesn't. - [Conditional (Ternary) Operator](https://www.javascriptin30words.com/javascript-conditional-operator/): The condition is evaluated as a boolean. If the condition is true it returns the first expression, else it returns the second condition. - [Logical Operators](https://www.javascriptin30words.com/javascript-logical-operators/): There are three logical operators in JavaScript: || = OR && = AND ! = NOT - [For Loops](https://www.javascriptin30words.com/javascript-for-loops/): A for loop creates a loop with three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement (usually a block statement) to be executed within the loop. - [While Loops](https://www.javascriptin30words.com/javascript-while-loops/): A while loop loops through a block of code "while" the condition is true. - [Switch Statements](https://www.javascriptin30words.com/javascript-switch-statements/): A switch statement is an alternative to multiple if statements. Switch statements are a more efficient way to code when testing multiple conditions. - [Arrow Functions](https://www.javascriptin30words.com/javascript-arrow-functions/): A concise syntax for creating functions. If we have only one argument, then parentheses around parameters can be omitted. Arrow functions do not have a 'this' context. - [Array Methods](https://www.javascriptin30words.com/javascript-array-methods/): forEach() - loop over array's items map() - new array by calling the provided function in every element filter() - new array with only elements that pass the condition - [String Methods](https://www.javascriptin30words.com/javascript-string-methods/): concat() Combines strings indexOf() returns index of character match() matches based on REGEXP slice() Returns a substring based on the “start” and “end” parameters split() Splits a string according to the specified delimiter - [Classes](https://www.javascriptin30words.com/javascript-classes/): ES6 syntactic sugar that allows us to program in a more object-orientated way. It allows us to define a constructor together with its prototype methods. - [Scope](https://www.javascriptin30words.com/javascript-scope/): Scope refers to the current context of code, which determines the accessibility of variables to JavaScript. - [DOM](https://www.javascriptin30words.com/javascript-dom/): The Document Object Model (DOM) represents a web page as a tree. JavaScript uses it to find elements, change their content, or add new ones. - [Events](https://www.javascriptin30words.com/javascript-events/): Events tell your code something happened, like a click or a keypress. Add a listener to run a function whenever that event occurs. ## Advanced - [The call stack](https://www.javascriptin30words.com/javascript-call-stack/): A Call Stack is a data structure that stores and manages function invocations. A kind of 'To-do list' for JavaScript that uses the Last In, First Out (LIFO) principle. - [Event loop](https://www.javascriptin30words.com/javascript-event-loop/): The Event Loop monitors the Call Stack and the Callback Queue. If the Call Stack is empty, it pushes the first event from the queue to the Call Stack. - [IIFEs](https://www.javascriptin30words.com/javascript-iife/): An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined. Variables declared inside the IIFE have private scope. - [Nested functions](https://www.javascriptin30words.com/javascript-nested-functions/): A function within another function. A nested function can 'inherit' the arguments and variables of its containing function. Put simply, the inner function contains the scope of the outer function. - [Recursion](https://www.javascriptin30words.com/javascript-recursion/): Recursion is a technique for iterating over an operation by having a function call itself repeatedly until it arrives at a result. Most loops can be rewritten recursively. - [Memoization](https://www.javascriptin30words.com/javascript-memoization/): Memoization is the programmatic practice of making recursive/iterative functions run faster by caching the values that the function returns after its initial execution. - [Closures](https://www.javascriptin30words.com/javascript-closures/): The combination of a function and the environment in which it was declared. In JavaScript all functions form closures. A common use case is creating private functions. - [Hoisting](https://www.javascriptin30words.com/javascript-hoisting/): Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. - [Currying](https://www.javascriptin30words.com/javascript-currying/): Currying is the process of transferring a function with many arguments into the same function with fewer arguments. Allowing you to partially apply functions and pass them to higher-order functions. - [Value vs reference](https://www.javascriptin30words.com/javascript-value-vs-reference/): Pass by value means the actual value is passed on. Pass by reference means a number (where the value is stored in memory) is passed on. - [Asynchronous JavaScript](https://www.javascriptin30words.com/javascript-asynchronous-programming/): JavaScript is a single-threaded language. Meaning it performs one action at a time. Asynchronous JavaScript is a way to perform multiple actions simultaneously using callbacks, promises, and async/await. - [Promises](https://www.javascriptin30words.com/javascript-promises/): A promise is an object that may produce a value sometime in the future. Either a resolved value or a reason that it’s not resolved (e.g., a network error occurred). - [Async and await](https://www.javascriptin30words.com/javascript-async-await/): Async/Await is syntactic sugar that makes promises easier to work with. It allows us to write asynchronous code that's similar in appearance to synchronous code. - [Global objects](https://www.javascriptin30words.com/javascript-global-objects/): A Global Object is an object that always exists in the global scope. In a browser, the Global Object is the 'Window' and in Node.js the object is Global. - [this keyword](https://www.javascriptin30words.com/javascript-this/): The “this” keyword allows you to decide which object should be focal when invoking a function or a method; effectively allowing you to reuse functions with different contexts. - [call()](https://www.javascriptin30words.com/javascript-call/): With call you can write a method once, and then inherit it in another object, without having to rewrite the method for the new object. - [apply()](https://www.javascriptin30words.com/javascript-apply/): The only difference between apply() and call() is that the second parameter of the apply() method accepts the arguments to the actual function as an array. - [bind()](https://www.javascriptin30words.com/javascript-bind/): Similar to call and apply except bind() returns a function instead of a value. It sets the value of 'this' and returns a function. It does not invoke the function. - [Prototypal inheritance](https://www.javascriptin30words.com/javascript-prototypal-inheritance/): Inheritance is simply one object trying to inherit properties and methods of another object. A prototype is simply an object with inbuilt methods that are attached to your object. - [Polymorphism](https://www.javascriptin30words.com/javascript-polymorphism/): Polymorphism is the practice of designing objects to share behaviors and to be able to override shared behaviors with specific ones. Polymorphism utilizes inheritance in order to make this happen.