In my current coding challenge, I'm attempting to create a function that takes two variables, adds them together, and displays the result in an alert format. Unfortunately, I seem to be encountering an issue with my code. Any guidance or assistance would be greatly appreciated!
var num1 = prompt("Enter first number:");
var num2 = prompt("Enter second number:");
var a = parseInt(num1);
var b = parseInt(num2);
var total = 0;
function addTwoNumbers(x, y) {
total = x + y;
}
addTwoNumbers(a, b);
alert("The sum of the two numbers is: " + total);