Here we are learning JavaScript programming language (JS), you can use any programming language that you are good at, the point here is that we only learn logic.
let string = ""; for (let i = 1; i < 10; i++) { for (let j = 1; j <= 10; j++) { string +="* "; } string += "< br >" } document.getElementById("sesuai nama div").innerHTML = string;
let string = ""; for (let i = 1; i <= 10; i++) { for (let j = 1; j <= i; j++) { string +="* "; } string += "< br >"; } document.getElementById("sesuai nama div").innerHTML = string;
let string = ""; for (let i = 10; i >= 1; i--) { for (let j = 1; j <= i; j++) { string +="* "; } string += "< br >"; } document.getElementById("sesuai nama div").innerHTML = string;
let string = ""; for (let i = 10; i >= 1; i--) { for (let j = 1; j <= i; j++) { string +="* "; } string += "< br >"; } for (let k = 9; k >= 1; k--) { for (let u = 1; u <= k; u++) { string += "* "; } string += "< br >"; } document.getElementById("sesuai nama div").innerHTML = string;
Thus our practice today, I hope it can be understood. The above method is not the only way to create a pattern. There are many more ways that are shorter than this. Keep practicing, and don't give up