Techblog

Tech Blog

Our latest geek adventures!

13 March Prototype extends your arrays!

Posted by jaap on in Javascript

When using:

var lElements = ["el1","el2","el3"];
foreach(var el in arr) {
  alert(el);
}

in Javascript and afterwards you add the Prototype library, don’t forget it extends your array! When doing the foreach, all extra functions that the (still wonderfull) Prototype Library adds, will be displayed. I had some weird problems after adding the javascript source file of Prototype. It took me a while to understand why my code didn’t do what I intended. After displaying this foreach loop, I saw the problem!

Leave a Reply