<html>
<head>
<title>Adding Function</title>
</head>
<body>
<p id = "demo"></p>
<button type = "button" onclick = "addFun()">+</button>
<script>
var add = (function(){
var counter = 0;
return function(){
counter += 1;
return counter;
}
})();
function addFun(){
document.getElementById("demo").innerHTML = add();
}
document.getElementById("demo").innerHTML = 0;
</script>
</body>
</html>

TNW provides the best ICT solutions for your business by the reasonable price.
TNW - ICT Solutions
Adding Function
- Details
- Written by Thet Naing Win
- Category: Javascript
- Hits: 442