Prev Demo
JavaScript
>
Subtract And Assign
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Subtract and Assign</h1> <script> function Subtractassignvalue() { var a = document.getElementById("txtA").value; var result = 5; result -= parseInt(a); alert(result); } </script> Enter two digit: <input type="text" id="txtA" name="txtA" /> <input type="button" name="btnSubtractassignvalue" value="Subtract & Assign value" onclick="Subtractassignvalue()" /> </body> </html>
Note: We DO NOT save your trial code in our database.
Output