Javascript Array reduce_a_fraction()
Array.prototype.reduce_a_fraction = function () { var m = this[0]; var n = this[1]; var a = (m < n) ? m : n; while (true) {/*from www . j a va2 s . c o m*/ if (m % a == 0 && n % a == 0) break; a--; } return [m / a, n / a]; } NodeList.prototype.map = function (callback) { for (var i = 0; i < this.length; i++) callback(this[i]); }