Am trying to draw a star using canvas, but the code is not running. I want to understand: what are the steps to measure the Y and X coordinate? How to find them? to draw any
As mentioned by @v-rubinetti, you are trying to call methods incorrectly.
While it can be easy to draw a simple star in canvas by coding, it's complicated for drawing advanced things. You can use a open-source Vector graphics software like Inkscape along with the ink2canvas extension to draw advanced vector graphics and save them to a html5 document.
For example, here is a 25-pointed Star drawn in Inkscape and saved using ink2canvas extension:
Inkscape Output