1var age = 18; // number
2var name = "Jane"; // string
3var name = {first:"Jane", last:"Doe"}; // object
4var truth = false; // boolean
5var sheets = ["HTML","CSS","JS"]; // array
6var a; typeof a; // undefined
7var a = null; // value null
8
1/*
2The latest ECMAScript standard defines nine types:
3
4Six Data Types that are primitives, checked by typeof operator:
5undefined : typeof instance === "undefined"
6Boolean : typeof instance === "boolean"
7Number : typeof instance === "number"
8String : typeof instance === "string"
9BigInt : typeof instance === "bigint"
10Symbol : typeof instance === "symbol"
11Structural Types:
12Object : typeof instance === "object". Special non-data but Structural type for any constructed object instance also used as data structures: new Object, new Array, new Map, new Set, new WeakMap, new WeakSet, new Date and almost everything made with new keyword;
13Function : a non-data structure, though it also answers for typeof operator: typeof instance === "function". This is merely a special shorthand for Functions, though every Function constructor is derived from Object constructor.
14Structural Root Primitive:
15null : typeof instance === "object". Special primitive type having additional usage for its value: if object is not inherited, then null is shown;
16*/
1dataTypes = {
2 Numbers = 1,2,3, 100, 3.14
3 Strings = 'Hello, World' "helloworld@gmail.com
4 Boolean = true / false
5 Null = 'Explicitly set a variable with no Value'
6 Undefined = 'For variable that have not yet been defined'
7 Object = 'Complex data structures - Arrays, Dates, Literals etc'
8 Symbol = 'Used with objects' // usually not needed
9}
1let a = ["A", 1, true, [], [2, 'x'],{},{a:'B'}, NaN, undefined, null];
2let s = a.toString();
3console.log(s);//"A,1,true,,2,x,[object Object],[object Object],NaN,, "