JavaScript: Draw a right-angled triangle
JavaScript Drawing: Exercise-4 with Solution
Right-Angled Triangle
Write a JavaScript program to draw the following right-angled triangle.
Sample output:
Sample Solution:
HTML Code:
JavaScript Code:
Live Demo:
Improve this sample solution and post your code through Disqus.
Previous: Write a JavaScript program to draw two intersecting rectangles, one of which has alpha transparency.
Next: Write a JavaScript program to draw the following diagram [use moveto() function].
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics