Functional inheritance js