Object is a factory in JavaScript

Object is basically a factory pattern that generates different types of variables. See the code below:

var obj = Object();  // equals to new Object();
var num = Object(2);
var str = Object("lichgo");
var boo = Object(false);

Magic is real!

obj.constructor === Object;  //true
num.constructor === Number;  //true
str.constructor === String;  //true
boo.constructor === Boolean; //true