To retrieve the literal object form of an instance of the global String Object in the console we simply do:
var myString = new String("Hello Stackoverflow!");
console.log(myString);
/* console outputs: String {0: "H", 1: "e", 2: "l",..., 18: "w",
19: "!", length: 20, [[PrimitiveValue]]: "Hello Stackoverflow!"} */
But when one creates a regular expression instance of global RegExp object and try to get the object literal form, it won't work and console will just output the regular expression pattern and flags.
var myRegexp = new RegExp("\\d+","g");
console.log(myRegexp);
/* console outputs: /\d+/g while I would expect RegExp{..., global:true,...}
basically the look of an object with curly braces and properties*/
How can I retrieve that regular expression object instance with all its properties and show it in the console?