javascript: remove redundant local constructors