4)Write a JavaScript Program to read
a number from user, store its factors into the array and
display that array. (Handle onClick
Event)
<hmtl><head>
<script>
function display()
{
var no=parseInt(prompt("Enter a
number"));
var fact=new Array(10);
var j=0;
for(i=1;i<=no/2;i++)
{
if(no%i==0)
{
fact[j]=i;
j++;
}
}
for(i=0;i<j;i++)
document.write(fact[i]+"</br>");
}
</script></head>
<input type=button id=clk
value="Enter Number" onclick="display()">
</html>