They do two very different things:
for (var i=0; i<L.length; i++) { ... } iterates over ALL indexes, including array elements that "are undefined".
forEach iterates only on defined elements.
Note also that being "undefined" doesn't simply mean that the value of an element is undefined, but that the element as never been set and the two are very different things:
a = [];
a[3] = 9;
a.indexOf(undefined) // --> -1
a[1] = undefined;
a.indexOf(undefined) // --> 1
so you can have a defined element with value undefined...
a = [];
a[9] = 9;
a[3] = undefined;
a.forEach(function(){ console.log(arguments); });
will show two lines, one for element with index 9 and one for element with index 3