condense JavaScript