Pyramid Triangle Logic
Hello I'm a beginner in JavaScript programming. I really like the logical aspect of programming so I like to come up with my own logics for my codes. I wrote this code to print a pyramid triangle after a lot of thinking with trial and error but I don't know if it is the correct way to do it. If you notice I use 3 arguments in the initialization of the first for loop and 2 final expressions. I need to know if this is a good or bad programming practice and if there is a better way to do it please share. This is the code: for(let a = 10, b = a, c = b; a >= 0; a--, b -= 2) { for(let d = 0; d <= c; d++) { if(b < 0) { break; } else if(d < b) { document.write(" "); } else if(d <= c) { document.write("*"); } } document.write("<br>"); }