You should not receive the "unexpected identifier" error from the mini-code you submitted. If so, this is a bug in the JavaScript engine with which you use it. This is true for the code you posted originally:
function arc(r,p,a){return"A"+r+","+r+" 0 "+ +(a>Math.PI)+",1 "+p;}
But with the updated code you posted:
function arc(r,p,a){return"A"+r+","+r+" 0 "++(a>Math.PI)+",1 "+p;}
... this is a problem because ++ is an increment operator (either the prefix [ ++a ] or the postfix [ a++ ]). And for this you need an identifier (a thing to increase). ++ simply invalid in this position (the exact error you get may vary depending on the JavaScript mechanism).
You can protect the code from the minifier by doing this by slightly changing it:
function arc(r, p, a) { return "A" + r + "," + r + " 0 " + (+(a > Math.PI)) + ",1 " + p; }
Paranas prevent the combination of + and other + in ++ . They also make the intention a little clearer, IMHO.
I repeat the second part of your question, no, you cannot delete this + , this will change the function. In particular, a > Math.PI will be true or false , and + should make it a number ( 1 for true , 0 for false ) before it is concatenated with a string. If you delete it, you will see true or false in the line instead of 1 or 0 .
Tj crowder
source share