简体   繁体   中英

JS hint errors on jsfiddle -how to decipher and debug

I am getting jshint errors on a fiddle but can't figure out why. When I extract the snippets that are causing an issue and test on jslint.com there are no warnings or errors. Am I doing this in an incorrect manner. I am basically wanting to log arguments in the jsfiddle view so I can see what is going on, and get a clearer picture of how functions operate.

 function fakeReplace(data, substr, newstr) { div.append("data before match replace = " + data); div.append("\\<br>"); div.append("substr = " + substr); div.append("\\<br>"); div.append("newstr = " + newstr); div.append("\\<br>"); return data.map(function (s) { return s.split(substr).join(newstr); }); } 

the fiddle in question

The code in your question is producing jshint errors because < does not necessarily need to be escaped.

The regular expression in your fiddle is triggering it because it wants to encourage wrapping your regular expressions in parentheses (eg (/""/g).test(x) ).

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM