0

I'm trying out sample code on http://sequelizejs.com/ main page. Under "simple usage" the first two lines of code are as follows:

var Sequelize = require('sequelize')
  , sequelize = new Sequelize('database', 'username', 'password')

I noticed that when I changed the code to the following, everything stops working.

var Sequelize = require('sequelize')
  , sequelize = new require('sequelize')('database', 'username', 'password')

From my understanding, the 2 lines above should do the exact same thing. Why is my understanding wrong?

nwarp
  • 641
  • 3
  • 8
  • 15
  • 1
    No, they are not the same. See [How does require work with new operator in node.js](http://stackoverflow.com/questions/17604497/how-does-require-work-with-new-operator-in-node-js) for more info. – Leonid Beschastny Jul 21 '14 at 10:00
  • I see. Thanks for the link! – nwarp Jul 22 '14 at 02:06

0 Answers0