Data Types in JavaScript

Amanda M Johnson
Aug 17, 2020 · 2 min read

In this post, I will go over the different data types used in JavaScript programming.

Photo by Michael Dziedzic on Unsplash

Depending on where you look, there are several different numbers of exactly how many data types there are in the JavaScript language. I will be describing 8 different JavaScript data types and they fall under 3 different categories: primitive, composite, and special data types.

Primitive or Primary Data Types

There are 6 data types that are considered primitive values. They are strings, numbers, bigint, boolean, undefined and symbols. Because all of these data types are not objects and don’t have their own methods, they are considered primitive and are the simplest level of the language implementation. Besides that, primitives cannot be changed, so they are immutable. When assigning primitive values to variables, that will not make the variable necessarily primitive because the value of the variable itself has the ability to change, so it is mutable.

Composite or Reference Data Types

Objects, arrays and functions fall into the composite data type category. Though, arrays and functions are considered objects in JavaScript OOP, so an object is essentially the only composite type. One of the reasons these are considered composite types is due to the fact that they can have multiple values that are grouped together. The values in composite types can also contain a mix of values that contain any of the primitive data types and composite types as well. Another quality that composite data types have is that they can have properties and methods associated with them that can be accessed through dot notation and trailing parenthesis that invoke specific functions.

Special Data Types

Null values are considered special data types and can also be referred to as special primitive types because of their similarity to primitives. The difference between a null value and a primitive value is that null represents the intentional absence of data or the lack of relation to an object. A null value can be returned when an object is expected but no existing object is relevant.

It is important to understand data types when working with any programming language because data can be stored improperly and cause bugs in your applications.

Dev Genius

Sign up for Best Stories

By Dev Genius

The best stories sent monthly to your email. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Amanda M Johnson

Written by

Full Stack Software Engineer | manda.m.johnson@gmail.com

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Amanda M Johnson

Written by

Full Stack Software Engineer | manda.m.johnson@gmail.com

Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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