+ sign is concatenating instead of adding

Im very beginner, and I know we must be carefull with plus sign because sometimes its happen, it concatenate instead of adding. Can someone help with the code bellow? Wy is it concatenating?

                var num1 = prompt('Enter a number')
		var operator = prompt('Enter a operator')
		var num2 = prompt('Enter another number')

		var gettingResult = function (num1, operator, num2) {
				var result = 0

				num1 = parseFloat(num1)
				num1 = parseFloat(num2)

				if (operator == '*'){
						result = num1 * num2
				} else if (operator == '+'){
						result = num1 + num2
				} else if (operator == '-'){
						result = num1 - num2
				}	else if (operator == '/'){
						result = num1 / num2
				} else {
					document.write('Error on input its not a operator')
				}

				return result
		}


		document.write(gettingResult(num1, operator, num2))

num2 is a string, that is the effect that you have with + and strings
do you get the right result with the other operators?

Look carefully here.

Thank you so much @JeremyLT. As I told Im very beginner, doing beginners mistakes.

Thank you so much @ilenia now its working, was the duplicated variable. Im completely beginner.