Wow. It's the var inside the for statement that it doesn't like.

Simpler example:

function foo( bar ) {
    for( var i = 0; i < 2; i++ ) {
        bar( i );
    }
}

It's perfectly happy with this version (with default settings):

function foo( bar ) {
    bar( -1 );
    var i;
    for( i = 0; i < 2; i++ ) {
        bar( i );
    }
}

Well, not exactly my cup of tea. I *like* the var inside the for loop, thank
you.

Benefit of the doubt: Seeing as how it's not configurable and jslint was
updated a few days ago, maybe it's just a bug? :-)

-Mike

On Fri, Jan 14, 2011 at 10:56 AM, cancel bubble <[email protected]>wrote:

> function wee(){
>     var arr = ['sweet',1,true],
>     count = 0;
>
>     //gimme inArray() if it doesn't natively exist
>     if (typeof Array.prototype.inArray !== 'function') {
>         Array.prototype.inArray = function (value) {
>             for (var i=0; i<this.length; i++) {
>                 if (this[i] === value) {
>                     return true;
>                 }
>             }
>             return false;
>         };
>     }
> }
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to