Loops in JavaScript
Full Stack Web Development Courses with Real-time projects Start Now!!
Program 1
<html>
<head><title>Demo for Loops in JavaScript</title>
<script langugage="javascript">
var i,n,j
n=parseInt(prompt("Enter a limit"))
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
document.write("<center>")
document.write("<font color=red size=8>")
document.write("*")
document.write("</font>")
document.write("</center>")
}
}
</script>
</head>
<body>
</body>
</html>Program 2
<html>
<head><title>Demo for Loops in JavaScript</title>
<script langugage="javascript">
var n,r,s=0,m
n=parseInt(prompt("Enter a number"))
m=n
document.write("<center>")
document.write("<font color=blue size=5>")
while(n!=0)
{
r=parseInt(n%10)
r=parseInt(r)
//s=s+r
s=(s*10)+r
n=parseInt(n/10)
}
if(m==s)
document.write(" No is palindrom")
else
document.write(" No is not palindrom")
// document.write("Reverse is: ")
// document.write(s)
document.write("</font>")
document.write("</center>")
</script>
</head>
<body>
</body>
</html>
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

