A complete list of pre-configured objects in Javascript

Posted 2 years ago

      var aNumber = new Number('17');
      var aNumberS = 17; // Literal shorthand
      var aString = new String('String');
      var aStringS = 'String'; // Literal shorthand
      var aObject = new Object ();
      var aObjectS = {}; // Literal shorthand
      var aArray = new Array();
      var aArrayS = []; // Literal shorthand
      var aBoolean = new Boolean('true');
      var aBooleanS = false; // Literal shorthand
      var aFunction = new Function();
      var aFunctionS = function(){}; // Literal shorthand
      var aDate = new Date ();
      var aRegExp = new RegExp('/d/');
      var aRegExpS = /d/; // Literal shorthand
      var aError = new Error();

      console.log( aNumber ) // Number {[[PrimitiveValue]]: 17}
      console.log( aNumberS ) // 17
      console.log( aNumber.constructor === Number ) // true
      console.log( aNumberS.constructor === Number ) // true