I think that you yourself understand that if you rename $R in the external or internal area of ​​the function, the "JSLint" error will be fixed.
I decided to write my answer only because I think there is a misunderstanding regarding the purpose of JSLint. This is not just a tool to help you find bugs in terms of the JavaScript language. You can view the tool as AddOn in a JavaScript book : The Good Parts . Douglas Crockford tried to show which language constructs might be misunderstood by people who read the code . Some of the possible misunderstandings, which he announced as “warnings,” and others as “errors.” Some of the “warnings” or “errors” may be suppressed by comments such as /*jslint ... */ there is no other (for example, the var declaration inside the for-loop header). The choice, which a potential misunderstanding should be interpreted as a “warning”, and which as a “mistake”, is very subjective and represents only the personal meaning of Douglas Crockford.
I do not always agree with the recommendations of Douglas Crockford, but the warning ("error"): '$R' is already defined I personally consider it also critical because of the difficulties with reading such code. I would recommend you rename one of the $R variables. I want to emphasize once again that the purpose of such changes is not to fix the JavaScript error, but to improve the readability of your program for other people .
By the way, I would recommend using variables with all uppercase letters only at the top level ( $R looks like this, regardless of the first letter $ ). See the last sentence for a JSLint naming recommendation .
source share