Edit in JSFiddle

function log(msg){
  var e = $("#console");
  e.html(e.html() + "<br>" + msg);
}

Function("p1,p2,p3", "p4", "p1(p2 + p3 + p4);")(log, " second", " third", " fourth", " not used");

<p id="console"></p>