I have an object:
function Shape(color, position, coordinates){
this.color = color;
this.position = position;
this.coordinates = coordinates;
this.shrink = function(){
reduce(coordinates);
};
};
And one of many objects with a 'is a' relationship to the previous object.
function Sphere(color, position, coordinates, radius){
this.radius = radius;
this.role = function(){
move(coordinates);
};
};
And a separate Draw function which draws the shapes
function draw(shape){
moveTo(shape.position);
setColor(shape.color);
sketch(shape.coordinates);
};
I know I should try use composition where possible but in some cases such as the one above, inheritance is a much more fitting model.
Without frameworks and as simply as possible how could I use prototypal inheritance or any other form to inherit the functionality and attributes of shape so I don't have to redefine them for every shape type I create and be able to pass arguments into the constructor of the inheriters object so they are passed to the object being inherited from.
EDIT
I searched the posts with similar titles and non of them provided examples regarding my specific situation, passing arguments in constructor and inheriting variables and functions. Also I find answer regarding this subject tend to present multiple options and I was looking for a more definitive answer on the standard approach (by way of example)
With regard to the so called definitive answer Performing inheritance in JavaScript I find that if I was to define all my attributes as described in prototype functions my script would be a mess, also it doesn't present what to do with arguments passed to the constructor.