Skip to main content

Data types


Dynamic typing#

JavaScript is a loosely typed or dynamic language. This means that you do not need to define the type of the variable πŸ”” in advance.


The type will be determined automatically during program execution. It also means that you can use one variable πŸ”” to store πŸ“¦ different types of data πŸ‘‡:

Live Editor
SyntaxError: Unexpected token (1:8)
1 : return ()


In order to understand the data type contained in a variable, the typeof operator is used. The typeof operator returns the type of the argument. It has two syntaxes, with brackets and without:

  • Operator syntax: typeof x

  • Function syntax: typeof (x)

They work the same, but the first syntax is shorter.

The result of typeof is a string containing the type.

Live Editor
SyntaxError: Unexpected token (1:8)
1 : return ()

Data types#

Data types

The JavaScript standard defines 9 data types. Get to know each of them by outputting to the console and then I will tell you about each of them in more detail.

let one = { firstName: 'John', lastName: 'Smith' } // object
let two = () => {} // function
let three = 'bar' // string
let four = 42 // number
let five = 19241924124n // bigint
let six = true // boolean
let seven = null // null
let eight // undefined
let nine = Symbol() // symbol


Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school

Contributors ✨#

Thanks goes to these wonderful people (emoji key):

Dmitriy Vasilev



πŸ› 🎨 πŸ–‹

Become a Patron!