Why does my javascript throw the following exception
ReferenceError: Invalid left-hand side expression in postfix operation
function convertToEnd(p) {
return ((((Number(p)-0)/100-0)*(1.5--0.5)-1.5)* -1);
}
Similar questions have been asked before here but as you can see from the various answers, the questions are very different (they usually result in an issue with a 3rd party, where as I have no third party), the only thing in common seems to be the exception string.
It's because of:
1.5--0.5
Change to:
1.5- -0.5
Alternatively a minifier will convert the whole calculation to:
return-1*(2*((Number(p)-0)/100-0)-1.5)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.