DEV Community

stalin s
stalin s

Posted on

JavaScript Primitive types

**Primitives Types **in JavaScript.

These are Seven basic data types in JavaScript.

listed below.
1) String.
2) Number.
3) Boolean
4) Null
5) Undefined
6) Symbol
7) BigInt.

Let's explore these javaScript primitives.

String.

A String represents text data in JavaScript. You create strings by enclosing them in quotation marks:

'Have a nice day'

Image description

We can use singular quote marks ('') or double quote marks ("") to create a string.

Number :

A Number represents numeric data. In Javascript, we can create numbers by writing the number directly in its numeric form:

2321321

Image description

Boolean :

Booleans are very much like light switches. They can only be “switched on” (true) or “switched off” (false).

console.log(true) // true
console.log(false) // false

Image description

Happy Learning

Top comments (0)