Boolean
The boolean data type can accept only two values i.e. true and false.
Example: Below is an example.
let x;
console.log(x); // Outputs: undefined
Output:
Primitive and Non-primitive data-types in JavaScript
In JavaScript, variables hold values, and each value possesses a data type that indicates the nature of the stored information. Broadly, JavaScript classifies data types into two categories: Primitive data types and Non-primitive data types. These distinctions are essential for understanding how data is handled and manipulated within the language. Let us discuss it one by one.