jsLint and prototype

Here is the snippet that I think is causing the issue.
The script works,


Array.prototype.remove = function(index){this.splice(index, 1);}

function buildNewDeck() {
    'use strict';
    var i;
...

but I cannot get jsLint to accept the code. (After reformatting for jsLint as follows)

Array.prototype.remove = function (index) {
    'use strict';
    this.splice(index, 1);
}

function buildNewDeck() {
    'use strict';
    var i;
...

I get the message

Unexpected ‘function’.

function buildNewDeck() {

line 14 character 1
Stopping. (30% scanned).

When I remove the Array.prototype, jsLint is error free.

When I relocate the Array.prototype to the end of the script I get the message

Expected ‘;’ and instead saw ‘(end)’.

}

for the code

    this.splice(index, 1);
}

there is no whitespace after the semicolon.

As I say, the code works. I just can’t get jsLint to accept it as valid.

You have a semi-colon missing after the } at the end of the first statement.

Array.prototype.remove = function (index) {
    'use strict';
    this.splice(index, 1);
}[b];[/b]

Thank you. Let me make sure I understand: I need the semicolon after the anonymous function because the statement is an assignment?

yes - all assignment statements should end with a semi colon. You shouldn’t rely on there being a new line before the next statement.