Working with NodeJS: Missing ‘new’ prefix when invoking a constructor

Posted: June 27, 2013 in Live in a Cloudy World, Windows Azure
Tags: , ,

For those who work with Microsoft Cloud Computing Platform, Windows Azure Mobile Services or Node JS in general, if you went through the development using JavaScript you might have faced this problem before: “Missing ‘new’ prefix when invoking a constructor”.

This Problem appears especially when you create a function and when you call this function in any other one, this problem appears. Actually you haven’t done anything wrong, this appears when you create the functions with Capital letters at the beginning like the following example:

insert()

{

Create();

}

Create()

{

}

If you create the function with a Capital Letter the JavaScript consider it as a constructor not like a normal function, that’s why you might face the following error.

You can avoid this by simply creating the functions without Capital letters in its beginning.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s