CanvasContext.fill()

    1. // begin path
    2. ctx.rect(10, 10, 100, 30)
    3. ctx.setFillStyle('yellow')
    4. ctx.fill()
    5. ctx.beginPath()
    6. ctx.rect(10, 40, 100, 30)
    7. // only fill this rect, not in current path
    8. ctx.setFillStyle('blue')
    9. ctx.rect(10, 100, 100, 30)
    10. // it will fill current path
    11. ctx.setFillStyle('red')