Hello
I'm learning JavaScript by reading "The Definitive Guide".
I saw JSHint and JSLint recommended to catch syntax errors, but I don't understand why they don't like this code:
Here's the report:Code:var s = "hello world!"; // A string var word = s.substring(s.indexOf(" ") + 1, s.length); // Use string properties document.write(word);
Why is document.write() wrong, and what else should I use to simply output something to the browser?Line 3: document.write(word);
document.write can be a form of eval.
Thank you.


Reply With Quote
Bookmarks