Member-only story

Data types in JavaScript?

habtesoft
2 min readMar 13, 2023

--

javascript data types img

In JavaScript, there are several data types that are used to store and manipulate data. Here’s a tutorial on the different types of data types in JavaScript:

Not a Medium member? Read this article here

  1. Numbers
let num = 5;

The number data type is used to store numeric values. It can be a positive, negative, or decimal number.

2. Strings:

let str = "Hello, World!";

The string data type is used to store text. It’s created by enclosing text in quotation marks (either single or double).

3. Booleans:

let bool = true;

The boolean data type is used to store true/false values. It’s often used in conditional statements.

4. Undefined:

let undefinedVariable;

The undefined data type is used to represent a variable that has not been assigned a value.

5. Null:

let nullVariable = null;

The null data type is used to represent a deliberate non-value.

6. Objects:

let obj = { name: "John", age: 30 };

--

--

habtesoft
habtesoft

Written by habtesoft

Passionate JavaScript developer with a focus on backend technologies. Always eager to connect and learn. Let’s talk, https://buymeacoffee.com/habtesoftat

No responses yet