hallo, ich mache folgendes:
//prototypisierung code start
Array.prototype.search = function(needle)
{
var result = false;
var haystack = this;
var arrHaystackLen = haystack.length;
for(var i=0; i<arrHaystackLen; i++)
{
if(haystack[i] == needle)
{
result = i;
}
}
return result;
}
//prototypsierung code ende
//testausgabe
var test = new Array(1,2,3);
r = test.search(3);
test.replace(2,1);
alert(r);
mit dem code zur prototypisierung grieg ich ne fehlermeldung dass die replace() funktion nicht bekannt wäre.
ohne geht sie.
wie kann das sein? da wird doch eigentlich nichts überschrieben?
danke!!