Need help with button not working


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

<p>Click the button</p>
<button onclick="myFunction()">Click</button>
<p id="demo"></p>
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;


Where did you write where para1 and para2 were?


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.


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