declare message at top of function.

Reason = Hoisting, explanation: http://www.i-programmer.info/programming/javascript/5364-javascript-hoisting-explained.html