-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.js
More file actions
23 lines (18 loc) · 737 Bytes
/
types.js
File metadata and controls
23 lines (18 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function ( window ) {
'use strict'
// constructor is a most often used property
var constructor = 'constructor'
// JavaScript literals are capable of acting like objects with properties
// The constructor property will return the function of which the literal is a prototype of
// For the Function constructor, we simply get the constructor of constructor[constructor] which returns String, which is a function
var Types = {
Boolean : (false)[constructor],
Number : 0[constructor],
String : constructor[constructor],
Array : [][constructor],
Function : constructor[constructor][constructor],
Object : ({})[constructor],
RegExp : /0/[constructor]
}
window.Types = Types
})( window );