1 / 3
amogtech
2 / 3
mhk
3 / 3
ccg


<html>
<head>
<title>Reducing Function</title>
</head>
<body>
<p id = "demo"></p>
<button type = "button" onclick = "redFun()">-</button>
<script>
var reduce = (function(){
var counter = 10;
return function(){
counter -= 1;
return counter;
}
})();
function redFun(){
document.getElementById("demo").innerHTML = reduce();
}
document.getElementById("demo").innerHTML = 10;
</script>
</body>
</html>


Share On:

What do you think?

Send us feedback!