- OBJECTS
- Basics
- Reference
- Methods
- Constructor
- FUNDAMENTALS
- Hello World
- Code Structure
- Use Strict
- Variables
-
Data Types
- Type Conversions
- Maths
- Comparitions
- Conditional
- Loops
- Functions
- TESTING
- Mocha
- Nested Describe
- TYPES
- Primitives
- Numbers
- Strings
- Arrays
- Json
- DESIGN PATTERN
- Observer Pattern
- CLASSES
- Constructor
- Binding
- Inheritance
Types
There are eight basic data types in JavaScript.
/**
* The typeof operator returns the type of the argument.
* In javascript there is no char type, only string.
*/
console.log(typeof undefined); // undefined
console.log(typeof 0); // number
console.log(typeof 10n); // bigint
console.log(typeof true); // boolean
console.log(typeof "foo"); // string
console.log(typeof Symbol("id")) // symbol
console.log(typeof Math); // object
console.log(typeof alert); // function
Null
Null is not an object, it a special type which represents nothing.
/**
* Null is a special data type which represents nothing.
*/
let a;
let b = null;
console.log(typeof a); // undefined
console.log(typeof b); // object
Last update: 531 days ago