new Object, code in moduls

This question already has an answer here:

  • What is the 'new' keyword in JavaScript? 13 answers

  • Douglas Crockford has a good article on how "new" works.

    In the example you give, the code in canvas.js (assuming the display.canvas should actually be display.Canvas ) is defining a function for how a new canvas is created. The main.js code uses that function to create a Canvas.

    链接地址: http://www.djcxy.com/p/40866.html

    上一篇: 在Node.Js上创建“新”对象

    下一篇: 新对象,模块中的代码