how to wite button code in function code example
Example 1: how to call a function with a button in javascript
<script>
function myFunction()
{
document.write("<h1>HELLO</h1>")
}
</script>
<button onclick="myFunction()">Click</button>
Example 2: how to make a button in javascript
<button id="btn">button</button>