In this example, the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect with the default state later.
HTML Online Editor
Your browser does not support the canvas element.
// Save the default statectx.save();
ctx.fillRect(10, 10, 100, 100);
// Restore the default statectx.restore();
ctx.fillRect(10, 140, 100, 100);