javascript trial and err