Bernard Aybouts - Blog - Miltonmarketing.com

Approx. read time: 8.5 min.

Post: JavaScript Glossary

JavaScript Glossary, for the beginner and new to JavaScript programmer

For a more comprehensive reference see Mozilla JavaScript Reference.

Arrays

ACCESSING ARRAY ELEMENTS

You can get elements out of arrays if you know their index. Array elements’ indices start at 0 and increment by 1, so the first element’s index is 0, the second element’s index is 1, the third element’s index is 2, etc.

Syntax

array[index];

Copy to Clipboard
For privacy reasons YouTube needs your permission to be loaded. For more details, please see our Privacy Policy – Legal Disclaimer – Site Content Policy.

ARRAY LITERALS

You can create arrays in two different ways. The most common of which is to list values in a pair of square brackets. JavaScript arrays can contain any types of values and they can be of mixed types.

Syntax

const arrayName = [element0, element1, ..., elementN]

Copy to Clipboard
For privacy reasons YouTube needs your permission to be loaded. For more details, please see our Privacy Policy – Legal Disclaimer – Site Content Policy.

MULTI-DIMENSIONAL ARRAYS

A two-dimensional array is an array within an array. If you fill this array with another array you get a three-dimensional array and so on.

Copy to Clipboard

ARRAY CONSTRUCTOR

You can also create an array using the Array constructor.

Copy to Clipboard

Read more: Creating an array

ACCESSING NESTED ARRAY ELEMENTS

Accessing multi-dimensional array elements is quite similar to one-dimension arrays. They are accessed by using [index][index]….. (number of them depends upon the number of arrays deep you want to go inside).

Syntax

array[index][index] //...

Copy to Clipboard

Booleans

BOOLEAN LITERALS


Syntax


true
false

BOOLEAN LOGICAL OPERATORS

Syntax
expression1 && expression2
// Returns true if both the 
//expressions evaluate to true

expression3 || expression4
// Returns true if either one of 
//the expression evaluates to true

!expression5
// Returns the opposite boolean 
//value of the expression


Example 1
if (true && false) 

if (false || true) 

if (!false) 

!!true // Evaluates to true

Console

CONSOLE.LOG

Prints text to the console. Useful for debugging.

Copy to Clipboard

CONSOLE.TIME

This function starts a timer which is useful for tracking how long an operation takes to happen.

Syntax
console.time(timerName);
Copy to Clipboard

Read more: console.time

CONSOLE.TIMEEND()

Stops a timer that was previously started by calling console.time().

Syntax
console.timeEnd(timerName);
Copy to Clipboard

Read more: console.timeEnd

Functions

Function Declaration

A function is a JavaScript procedure—a set of statements that performs a task or calculates a value.

Syntax
function name(argument1, argument2, /* ..., argumentN */) 
Copy to Clipboard

Read more: Functions

FUNCTION CALLING

Syntax
functionName(argument1, argument2, ..., argumentN);

Example
greet('Anonymous');
// Hello Anonymous!

FUNCTION HOISTING

The two ways of declaring functions produce different results. Declaring a function one way “hoists” it to the top of the call, and makes it available before it’s actually defined.

Copy to Clipboard

Read more: Hoisting

If statement

Basic If Statement

An if statement executes a block of code if the specified condition evaluates to true.


Syntax
if (condition) 

Example
if (answer === 42) 

ELSE

An else statement executes a block of code if the condition in the if statement evaluates to false.


Syntax
if (condition)  else 

Example
if (animal == 'dog')  else 

ELSE IF

An else if statement provides a new condition to test if the first condition is false.


Syntax
if (condition1)  else if (condition2)  else 

Example
if (someNumber > 10)  else if (someNumber < 0)  else 

Loops

FOR LOOPS

A for loop repeats until a specified condition evaluates to false, commonly used for iterating over arrays or executing a block of code a predetermined number of times.


Syntax
for (initialization; condition; increment) 

Example
for (let i = 0; i < 5; i++) 

WHILE LOOPS

A while loop executes its statements as long as the specified condition evaluates to true.


Syntax
while (condition) 

Example
let x = 0;
while (x < 5) 

DO WHILE LOOPS

A do…while loop executes its statements once before checking if the condition is true, then it repeats the loop as long as the condition is true.


Syntax
do  while (condition);

Example
let x = 0;
do  while (x < 5);

Read more: do…while

Math

Basic Mathematical Operations

JavaScript provides a Math object which encapsulates a variety of mathematical functions and constants.


// Generate a random number between 0 (inclusive) and 1 (exclusive)
Math.random();

// Round a number downward to its nearest whole number
Math.floor(4.7); // 4

// Calculate the power of a number
Math.pow(4, 2); // 16

Each method serves specific mathematical operations, ranging from basic arithmetic to complex calculations. Refer to the Mozilla Math Reference for a comprehensive understanding and additional examples.

Numbers

Basic Arithmetic

JavaScript supports standard arithmetic operations such as addition, subtraction, multiplication, and division.


// Addition
console.log(5 + 2); // 7

// Subtraction
console.log(5 - 2); // 3

// Multiplication
console.log(5 * 2); // 10

// Division
console.log(10 / 2); // 5

Special Number Operations

Beyond basic arithmetic, JavaScript Numbers can handle modulus, incrementation, decrementation, and detect non-numeric values.


// Modulus (Remainder)
console.log(10 % 4); // 2

// Increment
let x = 5;
console.log(++x); // 6

// Decrement
let y = 5;
console.log(--y); // 4

// Checking if a value is NaN (Not-a-Number)
console.log(isNaN("Hello")); // true

Objects

Creating and Accessing Objects

Objects in JavaScript can be created using object literals, and their properties can be accessed using dot notation or bracket notation.


// Creating an object
let person = ;

// Accessing object properties
console.log(person.name); // John
console.log(person['age']); // 30

Popup Boxes

Alert, Confirm, and Prompt

JavaScript provides three types of popup boxes: alert, confirm, and prompt, each serving different purposes.


// Alert box
alert("This is an alert box!");

// Confirm box
if (confirm("Are you sure?"))  else 

// Prompt box
let userResponse = prompt("Please enter your name:", "");
console.log(userResponse);

Strings

Basic String Operations

Strings in JavaScript are used to represent and manipulate a sequence of characters.


// Concatenation
let hello = "Hello, ";
let world = "world!";
console.log(hello + world); // "Hello, world!"

// Finding the length of a string
let str = "Hello, world!";
console.log(str.length); // 13

// Accessing characters in a string
console.log(str.charAt(0)); // "H"

Switch Statements

Using Switch for Conditional Logic

Switch statements are a way to execute different parts of code based on different cases.


let fruit = "apple";

switch (fruit) 

Ternary Operator

Conditional (Ternary) Operator

The ternary operator is a shortcut for the if-else statement that is used to assign values based on a condition.


// Syntax
condition ? valueIfTrue : valueIfFalse;

// Example
let age = 19;
let canVote = age >= 18 ? "Yes, you can vote." : "No, you cannot vote.";
console.log(canVote); // "Yes, you can vote."

Variables

Declaring Variables

Variables can be declared in JavaScript using var, let, or const, each with different scopes and mutability characteristics.


// var
var name = "John Doe";
// let
let age = 30;
// const
const birthday = "January 1, 1990";

Scope and Hoisting

Understanding the scope and hoisting behavior of variables is crucial in JavaScript development.


// Scope
if (true) 
console.log(varVariable); // Accessible
// console.log(letVariable); // Uncaught ReferenceError: letVariable is not defined

// Hoisting
console.log(hoistedVar); // undefined
var hoistedVar = "Hoisted";

Additional JavaScript Concepts

Event Handling

JavaScript allows interactive web pages by responding to user events.


// Example: Click event
document.getElementById("myButton").addEventListener("click", function() );

Asynchronous JavaScript

JavaScript supports asynchronous programming patterns like callbacks, promises, and async/await for non-blocking operations.


// Promise example
fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Modules

JavaScript modules allow you to split your code into separate files, making it more maintainable and reusable.


// Exporting a module
export const myFunction = () => ;

// Importing a module
import  from './myModule.js';
myFunction(); // "Hello, module!"

For comprehensive details on JavaScript, including advanced topics and best practices, consider visiting the MDN Web Docs.

Error Handling

Try, Catch, Finally

Error handling in JavaScript is accomplished using try, catch, finally blocks. This structure allows you to attempt to execute code that may throw an error, catch that error, and finally execute code regardless of the result.


// Syntax
try  catch (error)  finally 

// Example
try  catch (error)  finally 

Debugging

Console Methods and Debuggers

Debugging is a critical skill for any developer. JavaScript provides console methods like console.log(), console.error(), and console.warn() for logging information to the browser's console. Additionally, the debugger statement can be used to invoke any available debugging functionality, such as setting breakpoints.


// Using console
console.log("Log message");
console.error("Error message");
console.warn("Warning message");

// Using debugger
debugger; // Execution will pause here if the developer console is open

Good Practices

Coding Standards and Best Practices

Adhering to good practices in JavaScript enhances code readability, maintainability, and reduces the likelihood of errors.

  • Use clear and meaningful variable names.
  • Comment your code where necessary to explain "why" something is done.
  • Keep functions focused on a single task.
  • Avoid global variables to reduce the risk of conflicts.
  • Use let and const for variable declarations to ensure block-level scope.
  • Handle errors gracefully using try/catch blocks.
  • Write modular code using functions, classes, and modules.
  • Follow consistent coding conventions regarding naming, syntax, and structure.

For an in-depth look into best practices, visit MDN Web Docs: JavaScript Guide.

For privacy reasons YouTube needs your permission to be loaded. For more details, please see our Privacy Policy – Legal Disclaimer – Site Content Policy.

The Longevity Blueprint: AI-Powered Health Optimization

Current step:1AI-Human Medical Analyzer: Smarter, Personalized Health
2AI-Human Medical Analyzer: Smarter, Personalized Health

> SYS.HEALTH: AI-Human Medical Analyzer_

// Revolutionize Your Diagnostics

Experience the perfect blend of cutting-edge AI precision and expert human care. Our revolutionary analyzer turns your raw health data into personalized, actionable insights tailored just for you.

> INITIALIZING_BIOMETRIC_SCAN...

[+] DATA_INPUT

Securely upload complex health parameters, including lab bloodwork and comprehensive medical history.

[+] PROCESSING

Advanced algorithmic parsing combined with human-level oversight ensures hyper-accurate data interpretation.

[+] OUTPUT_MATRIX

Receive smarter, faster, and truly personalized care strategies to take immediate charge of your health journey.

A name/nickname is required to continue.

> TRANSLATION_MATRIX_ACTIVE...
[ LANG_EN ]
Knowledge Heals, Prevention Protects
[ LANG_HI ]
ज्ञान ठीक करता है, रोकथाम सुरक्षा करती है
[ LANG_ZH ]
知识治愈,预防保护
[ LANG_JA ]
知識は癒し、予防は守る
[ LANG_HE ]
הידע מרפא, המניעה מגנה
[ LANG_AR ]
المعرفة تُشفي، والوقاية تحمي
[ LANG_FR ]
La connaissance guérit, la prévention protège

> SYS.AUTH: Data Processing Consent_

[ AWAITING_AUTHORIZATION ] By providing consent, you allow us to process your uploaded data through our proprietary AI-Human analysis system.

  • [+] SECURE_REVIEW: This ensures your information is carefully reviewed using advanced AI technology and certified professional oversight to deliver personalized health insights.
  • [+] PRIVACY_LOCK: Your privacy is our strict priority. Your data will only be used for this specific diagnostic purpose.

> SYS.UPLOAD: Share Medical Records [OPTIONAL]_

[ USER_CONTROL_ACTIVE ] Uploading your medical records during registration is entirely optional. You can choose to bypass this step and provide data later if it suits your timeline.

You dictate the data flow: share as much or as little as you’re comfortable with, and let us guide you toward better health.

[+] FORMAT_SUPPORT

We accept all file formats, including photos, PDFs, text documents, and raw official medical data.

[+] DATA_YIELD

Increased inputs correlate with higher precision. The more info you share, the better we tailor your personalized insights.

> NEXT_STEPS: Post-Registration Protocol_

Once your registration is complete, a human specialist from our team will personally reach out to you within 3-10 business days. We will discuss your health journey and map out exactly how we can support you.

About the Author: Bernard Aybout (Virii8)

Avatar Of Bernard Aybout (Virii8)
I am a dedicated technology enthusiast with over 45 years of life experience, passionate about computers, AI, emerging technologies, and their real-world impact. As the founder of my personal blog, MiltonMarketing.com, I explore how AI, health tech, engineering, finance, and other advanced fields leverage innovation—not as a replacement for human expertise, but as a tool to enhance it. My focus is on bridging the gap between cutting-edge technology and practical applications, ensuring ethical, responsible, and transformative use across industries. MiltonMarketing.com is more than just a tech blog—it's a growing platform for expert insights. We welcome qualified writers and industry professionals from IT, AI, healthcare, engineering, HVAC, automotive, finance, and beyond to contribute their knowledge. If you have expertise to share in how AI and technology shape industries while complementing human skills, join us in driving meaningful conversations about the future of innovation. 🚀