Define JavaScript functions before they are used

Summary: This should be a fairly minor change that silences a bunch of JSHint warnings.

Test Plan: `arc lint` showed less warnings.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11064