Home  >  Article  >  Web Front-end  >  Defining objects in javascript factory mode_Basic knowledge

Defining objects in javascript factory mode_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 16:24:271121browse

Each function object has a length attribute, indicating the number of parameters the function expects to receive.

Copy code The code is as follows:








About the object-oriented creation method of js,

Target:

Construct an order object.
Contains three attributes: date, amount, submitter
Contains a method: display string: "XX submitted an order with an amount of XXXX yuan at XXXX-XX-XX"

1 Factory method

Copy code The code is as follows: