JSLint and JSHint will throw the "Read only" error when they encounter an attempt to assign a value to built-in native object. In the following example we attempt to overwrite String constructor function:
This error is raised to highlight a potentially dangerous piece of code. Your code will may fine if you do not fix this error, but it may be confusing to others, especially at first glance to someone quickly searching through your script, and it may break third party scripts.
It is perfectly valid to overwrite any of the native built-in functions, but there are limited use cases for it. JSLint and JSHint both forbid this practice completely and do not provide an option to allow it.
The list of read only functions used by JSLint is as follows:
JSHint uses the same list, but adds a few extra identifiers to it:
In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. The identifier of this warning is W020. This means you can tell JSHint to not issue this warning with the
/*jshint -W020 */ directive.