Rails JS best practices? (jQuery + Prototype / MooTools

Here's an interesting solution how to add all methods of underscore.js to native types

    // Underscore methods that we want to implement on Array.     var methods = ['each', 'map', 'reduce', 'reduceRight', 'detect', 'select',       'reject', 'all', 'any', 'include', 'invoke', 'pluck', 'max', 'min', 'sortBy',       'sortedIndex', 'toArray', 'size', 'first', 'rest', 'last', 'without',       'indexOf', 'lastIndexOf', 'isEmpty'];

    // Mix in each method as a proxy.     _.each(methods, function(method) {       Array.prototype[method] = function() {         return _[method].apply(_, [this].concat(_.toArray(arguments)));       };     });

full thread is here Extend · Issue #38 · jashkenas/underscore · GitHub