Here is a goal: how to get rid of foam when cooking jam

Which way makes more sense to accomplish this goal?
add a small pat of butter when cooking fruit for jams and jellies, you won't have any foam to skim off the top.