A thorough introduction to Numbers and Math in JavaScript

Numbers in JavaScript include both integers and floating point numbers as just a single Number type. This is unlike some other programming languages like C# which distinguish between the many types of numbers depending on the size of the number and space taken up in memory. Numbers in JavaScript can be very flexible but also pose some risks depending on how they’re processed by the program.

JavaScript Numbers and Math
JavaScript Numbers and Math
JavaScript Numbers and Math

Primitive number values have a Number object equivalent that wraps around the value and provides access to constants and methods that can be used to work with number values.

A new number can be…


Introduction to objects in JavaScript

Objects in JavaScript in their most basic definition are used to store data in key, value entries. Objects are a core building block of many programs in JavaScript and are used for things like storing complex data, building classes, and as an integral part of object-oriented programming. Within an object, a keyed value that stores data is called an object property. A keyed value that stores a function is called an object method. Although objects can be very complex, there are several important core concepts that are important to know first.

Getting Started with JavaScript Objects
Getting Started with JavaScript Objects
Getting Started with JavaScript Objects

This article introduces many core concepts about objects in…


Arrays at their most basic level are collections (or lists) of data. Since programs are constantly working with data, arrays are used extensively in JavaScript.

A typical program will add data to list, like products in a shopping cart, which can be stored in an array. The shopping cart array can have items added, removed, and rearranged.

To accomplish tasks like this, arrays come with many built-in methods that provide a lot of flexibility when working with them.

This article will examine how to create arrays, access data with them, and work with arrays.

JavaScript Arrays — An Overview with examples
JavaScript Arrays — An Overview with examples
JavaScript Arrays — An Overview with examples

There is extensive support for arrays…


Functions in JavaScript — A comprehensive introduction for beginners

Functions in JavaScript are segments of code that can be defined and then called when needed. They can be thought of as sub-programs within the overall program. Functions are helpful since they allow a programmer to write a piece of code once that can then be used multiple times throughout the program, which helps reduce code duplication. Functions also allow programmers to create discrete code segments that can be logically separated from other code within a program.

JavaScript — Basics of Functions
JavaScript — Basics of Functions
JavaScript — Basics of Functions

Functions include the following characteristics:

  • Can accept none or multiple parameters
  • Can return a specified value at the end of the function call


JavaScript offers several ways to control the flow of a program. Normally, a JavaScript program will begin to execute a program starting from the first line and continuing with each line to the end of the program.

There are several different ways to control the flow of the program, including conditional statements and loops. Each offer the ability for the programmer to evaluate different aspects of the program before continuing down a particular path or repeating a piece of code a specified number of times.

JavaScript — Program Flow
JavaScript — Program Flow
JavaScript — Program Flow

An important concept in JavaScript is the block statement, which is used extensively throughout programs…


JavaScript includes one operator that features three operands. This is called the ternary operator.

This post continues the series on JavaScript operators, wherein we had previously covered the unary and binary operators. The ternary operator is sometimes called a conditional operator and is used often for a shortened version of the if...else statement. Using the ternary operator can help to condense code, although it is sometimes criticized for contributing to less transparent and readable code compared to the if...else statement.

JavaScript Operators — Ternary Operators
JavaScript Operators — Ternary Operators
JavaScript Operators — Ternary Operators

The ternary operator, as the name implies, requires three operands. The ternary operator statement includes a condition, which is evaluated…


This is the second post in the JavaScript Operators series. Following up on the first post on unary operators, this time the focus is on binary operators, which make up the majority of all operators used in JavaScript. Binary Operators have multiple uses including arithmetic operations, relational and logical comparisons, and assignment.

JavaScript Operators — Binary Operators
JavaScript Operators — Binary Operators
JavaScript Operators — Binary Operators

Binary Operators

In contrast to unary operators, which require just one operand to perform its operation, binary operators require two operands — as the name applies. Mozilla Web Docs (MDN) has an extensive section on expressions and operators, which include binary operators. …


This post begins a series on JavaScript Operators and follows from a previous blog post on types and values in JavaScript. A core part of building a program in JavaScript is performing operations on values, which are more interesting when operations are performed upon them.

Being able to perform operations such as arithmetic, combining, comparing, performing logical checks, and other operations on values transform them into dynamic values. Different types have available different operations. And some operations behave differently depending on the types involved. Operators can be broken down into a few groups.

JavaScript Operators — Unary Operators
JavaScript Operators — Unary Operators
JavaScript Operators — Unary Operators

A unary operation is an operation that…


The foundation of any programming language is data. Without data, creating a program is very difficult, if not impossible.

Most interactions on the Internet involve data of some kind. Perhaps it’s bank account data, or data about a list of products in a shopping cart, or a message on a social media network, or the latest score from the basketball playoffs. Data is the reason why people start up a browser and explore the Internet. JavaScript allows programmers to control data values and the types of data used in a program.

Basics of JavaScript Types and Values

JavasScript allows programmers to work with a lot of…


Variables are a foundational aspect of programming with JavaScript, or any programming language. It’s essential to understand what variable are and what to expect when using them. For the longest time, JavaScript generally had only one way to declare variables, with the var keyword. Since the arrival of ES6 (ES2015), the keywords let and const have been available for variable declaration. The idea behind adding these features to the language was to provide ways to control how variables are declared, assigned values, and visible to other parts of a JavaScript program through the concept of scope.

Javascript Variables
Javascript Variables
Javascript Variables

This article focuses on…

Robert Laws

Web Developer and UX Designer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store