When I place the above code, it will show me following result:
<p>Click the button to calculate x.</p>
<button onclick="myFunction()">Try it</button>
If I press button "try it" it will show me a result 7.
Please give me an example.