I am very much new to Javascript please correct my code or suggest the best option
var myApp = {};
myApp.set = function(VAL) {
myApp.id = VAL;
}
myApp.get = function() {
return myApp.id;
}
function PageLoad() {
var X = new myApp;
var Y = new myApp;
Y.set(20);
X.set(10);
alert(X.get());
alert(Y.get());
}
It shows last assign value only i.e. 10 :(
Thanks in Advance Manoj
Uncaught TypeError: myApp is not a constructor.var X= new myApp()(parenthesis)newoperator.