//Create a test constructfunctionTest () {//New executes a different point from the direct execution of this      This. Init ();};//This points to the TestTest.prototype.init =function() {Console.log (' This is Test ');}//This points to windowfunctioninit () {Console.log (' This is window ');}//Direct Executionvart = Test ();//This is windowvarTest =NewTest ();//This is Test
Add another point:
Problem with constructor return value
If the return value of a function is the data of a reference type (array, object, or function), then the function is constructed with the new operator as a constructor, and the result of the operation is replaced by its return value, when the this value in the constructor body is lost and replaced by the returned object;
//Create a test constructfunctionTest () { This. A = 10; return {}; }; Console.log (NewTest ());//Object {}//Create a test constructfunctionTest () { This. A = 10; return1; }; Console.log (NewTest ());//Test {a:10}
Reference website: http://www.jb51.net/article/47871.htm
The difference between the constructor new execution and the direct execution