Array.prototype.inArray = function(valeur) {
for (var i in this) { if (this[i] === valeur) return i; }
return -1;
}
/*
in_array() renvois la clef si la valeur est présente, sinon, renvoie -1. exemple :
var t=new Array("coucou","test","plop");
alert( t.in_array("test") ); //affichera 1
alert( t.in_array("bobo") ); //affichera -1
*/
inArray prototype
Leave a Reply
You must be logged in to post a comment.