+ 1
Help please.not working.
function getTotal(a,b){ this.x= a; this.y= b; this.z = function (){ return this.x + this.y; } } var obj1 = new getTotal(2,23); document.write(z());
5 Answers
+ 1
obj1.z()
+ 1
Thanks.
I want output .how?
var myObject = {
firstName:"John",
lastName: "Doe",
fullName: function() {
return this;
}
}
document.getElementById("demo").innerHTML = myObject.fullName();
+ 1
return this.firstName+' '+this.lastName;
... but that's not a reason to not follow Martin Taylor advice ;P
+ 1
Thanks All.