Please see the following script:
var x = function(param){
this.data=param;
this.y = function(){
alert(this.data)
}
return this;
}
/*
x.prototype.z = function(){
alert(this.data);
}
*/
x(123).y();
x(123).z(); // This should behave same as y()
When I call x(123).y() then message displays 123. The function y() declared inside x()
Now I want to declare another function z() which will reside outside x() but will behave same as y() [associate with x()]
Is it possible? If possible how?