Learn more about one of the world’s most popular programming languages.
Every programming language is designed around storing information for your application or website. When storing this information, there is always a need to specify what kind of information is being stored. It could be numerical information or textual data. Sometimes it could be a logical state and sometimes it is a collection or list of information. Hence, every programming language ships with built-in data types also known as primitive data types.
NaN (not a number).
string type is used to represent textual data.
boolean data type represents logical entities.
Boolean values represent truth values:
undefined data type represents a variable that has not been assigned a value.
BigInt can represent integers with arbitrary precision, allowing you to store and operate on larger numbers beyond the integer limit.
If a value has the
symbol data type, it is an immutable and unique primitive value.
The non-primitive, complex data type
object allows you to store multiple data collections. Arrays are a type of object whose keys are integers. Arrays are a key building block for complex data structures.
Dynamic and Weakly Typed Language
let response = ‘Success’; console.log(response); // prints ‘Success’ response = true; console.log(response); // prints true
typeof operator that helps to understand the data type being stored in a certain variable at any given point in time.
const grade = 100; console.log(typeof grade); // prints number const greeting = ‘Merry Christmas’; console.log(typeof greeting); // prints string const hasGraduated = true; console.log(typeof hasGraduated); // prints boolean
const greeting = ‘Merry Christmas’; console.log(greeting.length); // prints 15;
Get hands-on experience writing code with interactive tutorials in our free online learning platform.
- Free and fun
- Designed for beginners
- No downloads or setup required