It does not draw anything, it just defines a new path.
How to draw triangle in html canvas. The moveto () defines the starting point of the line. You need to give a size to your canvas. Function draw () { var canvas = document.getelementbyid ('canvas');
The beginpath () method starts a new path.