Prev Demo
Number Prototype Properties In Javascript
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Prototype with for finding the fourth part</h1> <p>Click the below button create a new number method that returns a number's half value .</p> <input type="button" value="ClickHere!" onclick="HalfNumber()" /> <p id="myId"></p> <script> Number.prototype.myMethod = function () { return this.valueOf() / 4; } function HalfNumber() { var A = 36; document.getElementById("myId").innerHTML = A.myMethod(); } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output