Anzeige

A parameter initializer is only allowed in a function or constructor implementation.

#1
Javascript:
myArray = [12, 54, 18, 130, 44];

Array.prototype.myEvery = function (callback){

    var currIdx = 0;
    var result = true;

    while (this[currIdx] != undefined && result)
    {
        if ((!callback(this[currIdx])))
            result = false;

        currIdx++;
    }

    return result;
};


var result = myArray.myEvery(function (element) {return element >= 10; });
console.log(result);
Ich bekomme den im Titel genannten Fehler.
 
Anzeige

Neue Beiträge

Anzeige