Class-like inheritance in javascript