Social Icons

Pages

java operator for increament


<html>
<body>

<p>Given that y=5, calculate x=y++, and display the result.</p>
<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var y=5;
var x=y++;
var demoP=document.getElementById("demo")
demoP.innerHTML="x=" + x + ", y=" + y;
}
</script>

<p><strong>Note:</strong> Both variables, x and y, are affected.</p>
</body>
</html>

No comments:

Post a Comment