Suppose that I have this definition at the beginning of a file:
const ObjectId = mongoose.Types.ObjectId;
Which one should you prefer and why?
// 1
new ObjectId;
// 2
new ObjectId();
// 3
ObjectId();
The official document suggests using new ObjectId. For me new ObjectId() feels more natural but each of them generates a new ObjectId and I have seen examples for each of them in SO's questions and answers.
Update:
Let me clear this: I know why and how to use a new operator in JavaScript, I just want to find out is there any significant difference when new is used for ObjectID generation. (The function behaves different, throws an error, etc ...)