Refactor beer song javascript