how to print diamond pattern in javascript

Solutions on MaxInterview for how to print diamond pattern in javascript by the best coders in the world

showing results for - "how to print diamond pattern in javascript"
Bautista
14 Feb 2018
1<script type="text/javascript">
2
3
4    for(var i=1;i<=5;i++)
5        {
6            for(var j=1;j<=i;j++)
7                {
8                    console.log("*");
9                    
10                }
11            console.log("\n");
12        }
13
14
15
16</script>
Angelo
11 Sep 2017
1<script type="text/javascript">
2
3 for(let i=1; i<=4; i++){
4           for( let b = 1; b<=(rows-i); b++)
5           document.write("&nbsp;");
6           {
7               for (let f=1; f<=i; f++)
8               document.write("* ");
9           }
10           document.write("<br>")
11       }
12       </script>