JavaScript for build JavaScript Logic to use pattern
pattern 1
<script type=”text/javascript”>
for(let i=0;i<=5;i++){
for(let j=5;j>=i;j–){
document.write(“ ”);
}
for(let a=1;a<=i;a++){
document.write(“*”);
}
document.write(“<br>”);
}
</script>
pattern 2
<script type=”text/javascript”>
for(let i=0;i<=5;i++){
for(let a=1;a<=i;a++){
document.write(“ ”);
}
for(let j=5;j>=i;j–){
document.write(“*”);
}
document.write(“<br>”);
}
</script>
pattern 3
<script>
for(let i=1;i<=5;i++){
for(let k=5;k>=i;k–){
document.write(“ ”)
}
for(let j=1;j<=i;j++){
document.write(“*”);
}
document.write(“<br>”)
}
</script>