correction, check the inline comments
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
var a = 3;
var b = 4;
var c = 5;
var d = 6;
function add(w, x, y, z) {
var total = (w + x + y + z);
return total;
}
alert(add(a,b,c,d));
</script>
</head>
<body>
</body>
</html>
I have renamed the variables for better understanding. for more information on Javascript scopes refer this
JavaScript Scope[
^]
JavaScript Function Invocation[
^]