-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path02_dataTypes.js
19 lines (15 loc) · 945 Bytes
/
02_dataTypes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 2. Data Types
"use strict"; // By writing this, codes will be treated as newer version of Javascript in the files.
// alert(3 + 3) // We are using nodejs, not browser.
// Premitive Data Types,
let name = "Ayush" // This is String Data Type. ("Ayush")
let age = 21 // Number. (21)
// There is a range of numbers in JS, 2 to the power 53.
let isLoggedIn = true // This is Boolean Data Type. (true/false)
let state; // undefined. Value is not assigned.
// let state = null // null is a standalone value & it means empty. It states that the variable is empty.
// There is a one more Data type called symbols used to define uniqueness.
console.log(typeof name); // Tells type of the data type. In this it will show it's an String.
console.log(typeof age); // In age a number is assigned so this will show number.
console.log(typeof null); // Output will be object. Null is an Object.
console.log(typeof undefined); // Output will be Undefined.