Hello,
Can someone help me in developing my coding skills. I wrote code factorial. I see different logic at different places but no where I found the one that I wrote. Please tell me if there is anything worng in the below javascript code.var btn = document.querySelector('button');
btn.onclick = function(){
var total =1;
var num = Number(document.getElementById("num").value);
for(var i=0;i<num;i++){
total*=(num-i);
}
if(num===0){
document.getElementById('result').value = 1;
}
document.getElementById('result').value = total;
}