Let's talk about the difference between brackets and no brackets for constructors.
As follows:
// First define a constructor Hellofunction Hello () {alert (1) ;}// define a function expression var getName = function () {alert (2 );} // instantiate the object. If the following two constructors do not have any form parameters, the constructor can not be added with parentheses (recommended) during instantiation; var p = new Hello; var p1 = new Hello (); // when calling the getName function in the following method, the constructor may have different parentheses. new Hello. getName (); // the execution order is to execute Hello first. getName (), and then use the new keyword; new Hello (). getName; // This is an object first new Hello (), and then the object calls the getName method;
The difference between the brackets and the parentheses in the above detailed section is the whole content shared by the editor. I hope to give you a reference, and I hope you can also provide more support for the customer's house.