Skip to content
Advertisement

JavaScript triangle wrong direction how to make it correct?

I have a javascript question, I want to make a Triangle like this

JavaScript

this is my code which makes opposite direction

JavaScript

I wanna use for loop to make this triangle down bellow instead of using “repeat”.

JavaScript

Advertisement

Answer

You can write it like this:

JavaScript

This method can be used in all other programming languages, cause there’s no special js syntax or special js built-in function.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement