/firsy thing the most generally you can do
function Weapon(name, damage){
var wName = name; //use var instead of this so it will be private
this.setName = function(text){
//validate the data
if(typeof text === "string"){
wName = text ;
}//end of if
};
this.getName = function(){
return wName;
};
var wDamage = damage;
this.setDamage = function(aDamage){
//validate the data
if(typeof aDamage === "number" && aDamage < 200){
wDamage =aDamage ;
}//end of if
};//end of method
this.getDamage = function(){
return wDamage;
}; //end of method
} //end of contructor
//then you can inherit from Weapon and extend like this
function Gun( range, magazine){
var wName = "Gun" ; //overwrite the name so it will be named gun
//you write de set and get
var wDamage = 150 ; //The same--you can change this of course
var wRange = range ;
//write sets and gets
var wMagazine = magazine;
}//end of contructor