JavaScript Terms to Know | Basic & Advanced

Basic JS Terms

Attribute An attribute is a piece of information that controls access to a property More detail→

Conditional A conditional statement will be some variation of an if-then statement. These statements allow an application to test whether a particular condition is true and then take different action for a return of true or false. This sort of decision-making process where the answer is always one or the other ("true" or "false, "1" or "2", etc) is called "Boolean logic". In regular speech, this sort of logic would be used when saying "If dinner is ready, then come to the table, otherwise continue to watch TV".

Const The "const" statement creates a Constant. Constants are block-scoped, much like variables defined using the "let" statement. The value of a constant can not be changed through reassignment, and it can't be re-declared.

Deep Copy This is a more complicated simple approach to copying and object than a simple shallow copy defined above. A deep copy will copy nested arrays, key-value pair objects and the values of variables that point to objects. This is done recursively, which means to repeat the same actions again and again until complete.

Function This keyword allows us to define custom groups of code that perform a task or tasks.

JavaScriptOften abbreviated as JS, JavaScript is a programming language that conforms to the ECMAScript specification. JavaScript is high-level, often just-in-time compiled, and multi-paradigm. It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions. Initially, JavaScript was just a way for the Netscape browser to add movement to a page. This became popular, which led to other browsers adopting their own version. Eventually a standard was established for consistency. This standard became known as ECMAScript. Ecma International is the group that has continued to guide and grow the standard. EcMAScript changes go through a multi-stage process before becoming official JavaScript in a standard browser. From Wikipedia→

Let The "let" statement declares a block scope local variable, optionally initializing it to a value.

Loop A loop is a structure in code where you perform the same action or actions multiple times in a row.

Method When a property's value is a function, it is called a method. Stack has a few good descriptions of the theoretical differences between functions and methods here→

Object A collection of properties (see above). An object in JavaScript is similar to real world objects where each object carries certain properties. Like real-world objects, JavaScript objects can have unique properties and properties that mirror similar objects. There are many great explanations on Quora→

Property a property is an association between a name (or key) and a value. A property's value can be any JavaScript type. There is nice detail and a number of examples on MDN→

Recursive To repeat actions over and over again to complete a task is working recursively. In JavaScript, a recursive function will call itself repeatedly complete a task.

Shallow Copy This simple approach to copying and object is also called "Field-for-Field" copying, and that is probably more descriptive of what happens. Ultimately, each field is copied as it is, with primitive objects being duplicated for the new object. What makes this "shallow" is that it will only copy a reference to a memory reference and not duplicate the values. This means that variables that refer to an object, nested arrays and nested key-value pair objects will all have only the reference copied, not the values. In this, the data becomes shared and changing any of the data in these items will change it on both the original object and any duplicate objects. To have everything truly copied, including things like arrays, we need a deep copy.

Var This is short for "variable" and was a common way to create a variable in JavaScript prior to the creation of let and const.

Vanilla JavaScript is considered “vanilla“ when the standard JavaScript code is used with no framework or libraries. "Vanilla" in fact is not only used to describe the standard version of JavaScript but also other languages like CSS.

Advanced JS Terms

Arity This basically refers to the number of arguments or operands in a function or operation respectively. In JavaScript, this is most often used to describe the number of arguments expected by a JavaScript function.

There is even a property named arity, of the Function object that returns the number of expected arguments in a function. It is now obsolete though and replaced by length.

The following function has an arity of 3.

function userInfo(name, id, address) {
    return name + ' ' + id + ' ' + address;

Anonymous Function This type of function is not identified by a name. 
This is an IIFE (Immediately Invoked Function Expression). The function in it is anonymous since it doesn’t have a name.

(function (){
                        	// Code here...

Below is also an anonymous function because there is no name after the keyword function.

var foo = function() {
    // Code here...

Closure In JavaScript, closure is an inner function, that is accessible outside of its outer function’s scope, and maintains its connection to the outer function’s variables.

JavaScript closures are able to take parameters and bring back references to variables from inside a function that, otherwise, would be inaccessible.

function vacation() {

    var trip;

    function travelAgent(itinerary) {
        return trip;

    function agent(itinerary) {
        if (itinerary === 'Orlando') {
            trip = ['Orlando', 'Disney', 'Universal'];

    function book() {
    return travelAgent;

var myVacation = vacation();


// Array [ "Orlando", "Disney", "Universal", "booked" ]

In this code above, only travelAgent() (and its return value from inside thebook() function) is exposed to the outside world.

CurryingThe effect, named after Haskell Curry, is a process of using multiple functions with single arguments, in place of a single function with multiple arguments.

function addA(a) {
    function addB(b) {
        return a + b;
    return addB

function add(a, b) {
    return (a + b);

console.log(addA(3)(4)); \ 7
console.log(add(3, 4)); \ 7

Both of the functions above return the same result. The function addA accepts a parameter a while returning addB which in turn accepts the b value, performs the addition with a and returns the sum. The function add simply takes both a and b at the same time, performs the addition and returns the sum. So far the first function might not seem useful, until…

var add7 = addA(7);
console.log(add7(8)); //15
console.log(add7(6)); //13
console.log(add7(-21)); //-14

In currying, if you fix a step, like the addition of 7 above, you can streamline the process when a variable used in the operation is always the same.

Hoisting Most variable & function declarations are moved, or hoisted, to the top of the evaluation order.

With this, it does not matter where you type the code to declare a function or variable. During evaluation, all the declarations are moved up inside their current scope. With this, it is possible to write a function call before function is declared. Note: When in "strict mode", this behavior is changed. In strict mode, bad syntax is not allowed, hoisting is not done, silent errors are shown, etc. It helps in writing a more secure and optimized JavaScript code.

var name = 'Terry';
console.log(grabPassword(name)); // "terryPassword"

function grabPassword(name) {
    phrases = {
        'James': 'jamesPassword',
        'Terry': 'terryPassword',
        'Morgan': 'morganPassword'
    return phrases[name];

Mutation A Mutation, in JavaScript, refers to the changes that DOM elements recieved.

To illustrate, there is an API called MutationObserver to help watch for the DOM mutations, like adding child elements or changes to the element’s attributes.

Object State There is no official term "State" in Javascript, but this term is often used to refer to an Object's internal prperties values. This is most used in frameworks like React.js and others, but the principle is basilaly the same. As an Onject's property value changes, the state changes.

Pragma is short for 'pragmatic information'. In programming, pragma refers to the code that consist of useful information on how a compiler, interpreter or assembler should process the program.

It does not contribute anything to the programming language itself and its syntax may vary. pragma only affect the compiler behavior. JavaScript has a few pragmas, one of them is strict.

"use strict";

Sentinels In programming, sentinels are values that are used to indicate the end of a loop or process. They can also be called “flags”.

You can use any value as a sentinel. Here’s an example of sentinels used in JavaScript; the


method which returns -1 (the sentinel value) when the search value is not found in the targeted string. Below is a function that returns the position of an array value and if value is not found, returns -1.

function findArrayPosition(ary, val) {
    var i = 0,
        len = ary.length;
    for (; i & lt; len; i++) {
        if (ary[i] === val) return i + 1;
    return -1;
console.log(findArrayPosition(['a', 'b', 'c'], 'b')); // 2
console.log(findArrayPosition(['a', 'b', 'c'], 'z')); // -1

Variadic In English, variadic is an adjective created by joining “variable” and “adicity” (which basically means arity“ ); Ultimately, this variadic is used to express something that has variable number of arguments.

More specifically to JavaScript, a variadic function takes in any number of arguments. It can be created using the arguments property, apply method and, since ES6, the spread operator. Below is an example using a spread operator.

function test(...a) {
test('a', 'b', 'c', 8, [56, -89]);
//output is Array [ "a", "b", "c", 8, Array[2] ]

The definitions and code used in this section are compiled and rewritten into more plain English, from the following sources (If I have forgotten others please let me know and I will add them):

2 Replies to “JavaScript Terms to Know | Basic & Advanced”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

↑ Back to Top