Added the result variable and used that in the alert function as opposed to the string in the variable.