Using A Function Inside Of Another Function Javascript