how to override an object in javascript