Quick way to clean stove burner grates with ammonia and plastic bags

If you have gunked-up stove burner grates, this might do the trick. I wonder if it works for barbecue grills, too?