A couple of interesting things here. First, the object
method Add() is actually defined outside the object constructor block, though it references object properties using the "this" keyword. And second, just as object properties are defined using "this", object methods need to be defined in the same manner - witness my addition of
obj = new Sumthing(2, 89);
alert("The sum of " + obj.alpha + " and " + obj.beta + " is " + obj.Add());
and the output.
now that your object constructor is all ready to go, let's see a quick demonstration of how you can use it to spawn multiple instances of the same object, each operating independently of the other.
// one object
obj1 = new Sumthing(2, 89);
alert("The sum of " + obj1.alpha + " and " + obj1.beta + " is " +
// another one
obj2 = new Sumthing(546, 67);
alert("The sum of " + obj2.alpha + " and " + obj2.beta + " is " +
// and a third one
obj3 = new Sumthing(2364237, 283457);
alert("The sum of " + obj3.alpha + " and " + obj3.beta + " is " +