Ad
  • Custom User Avatar

    There's probably no performance benefit over a well written loop. But the standard algorithms are allways better than a bad loop. The real benefit is in "readability of intention". In nested loops it's hard to see what was intended, the standard algorithms state pretty well what they are doing, e.g. copy something if -a condition is true- and you can be sure they do that correctly and efficiently. I must admit that the (nested) lambdas look a little scary at first, but once you get the hang of it the code becomes easier to understand.

  • Default User Avatar

    Yah good eye, I may have to retract that comment, not sure what happened but it isn't working in chrome now.

    I might have been messing with polyfills, ah well it would be nice syntax, swiss army array objects.

    Also it is a little silly, it is a triangle function so it will only ever have the 3 arguments, but I was hoping to experiment with lists in js more.

  • Custom User Avatar

    YES, It's necessary to split the string into Array of Characters, because we can't call .filter() on a String (See MDN's article on Array.prototype.filter()).

    If you understood the please let me know.