JavaScript - Can anyone give me a idea in this

Asked By Mano on 10-Sep-10 04:59 AM
how can i print output like this 
*
**
***
by using for loop any ideas i tried so many times but it did'nt work out i don't know how to do
Super Man replied to Mano on 10-Sep-10 05:37 AM

It is so simple:

<script type="text/javascript">

    var line = 5;

    var x = 1;

    while (x <= line) {

      var y = 1;

      while (y <= x) {

        document.write('*');

        y = y + 1;

      }

      x = x + 1;

      document.write('<br>');

    }

 

 

</script>

 

 

Reena Jain replied to Mano on 10-Sep-10 06:17 AM
here you are

<
script type="text/javascript">
 
    
 
  for (x=1; x <=5; x++) {
 
    for (y=1; y <=x; y++) {
 
 
    document.write('*');
 
     }
    document.write('<br>');
   }
 
  }
 
 
</script>
Mano replied to Reena Jain on 10-Sep-10 11:39 AM
This is not working if i check out this in opera & I.E browsers Is there anyother codes for this 
Mano replied to Reena Jain on 10-Sep-10 11:40 AM
This is not working if i check out this in opera & I.E browsers Is there anyother codes for this