JSLint error: 'result' was used before it was defined.