if(typeof upto == "undefined"){ upto = args.length; } if(typeof from == "undefined"){ from = 0; } for(var i = from; i < upto; i += 2){ path.push(" "); path.push((last.x + args[i]).toFixed()); path.push(" "); path.push((last.y + args[i + 1]).toFixed()); }