I have written following code and it is not showing any alert.
var test = function(message) {
this.show = function() {
alert(message)
}
}
(new test("hiii")).show();
(new test("helooo")).show();
When changed to following...
Removed the bracket of - (new test("hiii")).show();
It shows both "hiii" and "helooo" alert.
Note: I did not make any changes to - (new test("helooo")).show();
var test = function(message) {
this.show = function() {
alert(message)
}
}
new test("hiii").show(); // was(new test("hiii")).show();
(new test("helooo")).show();
Can anyone explain why?