In JavaScript, there are several types of data that you can work with in your code. Here is a list of the basic data types in JavaScript:
Number: Numbers can be integers (e.g., 42) or floating-point values (e.g., 3.14). In JavaScript, all numbers are represented as double-precision floating-point values.
String: A string is a sequence of characters, represented in JavaScript by either single or double quotes (e.g., 'Hello, world!' or "Hello, world!").
Boolean: A boolean value represents a true or false value.
null: The null value represents the absence of a value or a null reference.
undefined: The undefined value represents a value that has not been assigned a value.
In addition to these basic data types, JavaScript also has several composite data types, which are data structures that can hold multiple values. These composite data types include:
Array: An array is a collection of values that are all of the same data type. Arrays are created using square brackets (e.g., [1, 2, 3]).
Object: An object is a collection of key-value pairs. Objects are created using curly braces (e.g., {name: 'John', age: 30}).
instagram @leandrobarbosa_____
Top comments (2)
The items in an array do not necessarily have to be the same data type:
We also have Bigint to store larger numbers.