extending class in javascript