What is the best way to have a Javascript 'class', for instance

// In the parent instance
function xyz()
{
    var x = 1;
}

I want to set this in the class, and when a user extends a class, I want them to effectively be extending this function. This is the user's code for instance:

// In the child instance
function xyz()
{
    var y = 2;
}

Merging should result in:

// In the merged instance
function xyz()
{
    var x = 1;
    var y = 2;
}
Edit
Report