Button not working on click, whats 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;
}

For some reason image uploading isnt working

It seems like you have put this inside the function

Try removing it and putting it outside the function! PS I havent tried it as well so! Just Try!

1 Like

I did it but it didnt work, instead i got [object Object] under click button, there is perhaps something wrong with eighter innerhtml or invoking. I really wish to figure this out