Need help with button not working


#1

Im trying to test out the code in jsfiddle, but clicking on button is not working, what is wrong?

<html>
<body>
<p>Click the button</p>
<button onclick="myFunction()">Click</button>
<p id="demo"></p>
</body>
</html>
function myFunction(para1, para2) {

var result;

if (para1 > para2) {
return “Good”;
} else {
return “Bad”;
}
var x = new myFunction(20, 40)
document.getElementById(“demo”).innerHTML = x;
}


#2

Where did you write where para1 and para2 were?


#3

Para1 and para2 are just functions arguments, i know how to receive the result without button but for some reason im missing something to make it work with button. I want it to return to paragraph eighter good or bad when clicking on button.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.