sample function declaration in function :
function Rectangle(height, width) {
this.height = height;
this.width = width;
this.calcArea = function() {
return this.height * this.width;
};
// put our perimeter function here!
this.calcPerimeter = function() {
return 2 * this.height + 2 * this.width;
};
sample new function declaration :
var actions = new function() {
console.log("this is to do something");
}
Why are we using new keyword while declaring a new function but not using new keyword while declaring it in a constructor??