Using javascript to implement weapon OO