Here’s a quick reference of various values and their types.
For further reference: see what types mean in Javascript and type casting in Javascript.
Value | Type | Description |
---|---|---|
true | boolean | Boolean |
1 | number | Number |
“1” | string | String |
“abcd” | string | String |
Boolean(false) | object | Boolean object |
Number(0) | object | Number object |
String(“abcd”) | object | String object |
[1, 2, 3] | object | Array object |
Object() | object | Plain object |
{} | object | Plain object |
function() {} | function | Function object |
Code to cross-check -
|
|
The only objective of the above table is to provide an overview of what you can expect when working with the loose-typing in Javascript.
Often times you don’t care about types in Javascript - I get that.