同步操作将从 黎晓/JavaScript 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*! This file exists only for testing a Minify installation. It's content is not used.** http://example.org/min/f=min/quick-test.js*//* Finds the lowest common multiple of two numbers */function LCMCalculator(x, y) { // constructor functionvar checkInt = function (x) { // inner functionif (x % 1 !== 0) {throw new TypeError(x + " is not an integer"); // throw an exception}return x;};this.a = checkInt(x);// ^ semicolons are optionalthis.b = checkInt(y);}// The prototype of object instances created by a constructor is// that constructor's "prototype" property.LCMCalculator.prototype = { // object literalconstructor: LCMCalculator, // when reassigning a prototype, set the constructor property appropriatelygcd: function () { // method that calculates the greatest common divisor// Euclidean algorithm:var a = Math.abs(this.a), b = Math.abs(this.b), t;if (a < b) {// swap variablest = b;b = a;a = t;}while (b !== 0) {t = b;b = a % b;a = t;}// Only need to calculate GCD once, so "redefine" this method.// (Actually not redefinition - it's defined on the instance itself,// so that this.gcd refers to this "redefinition" instead of LCMCalculator.prototype.gcd.)// Also, 'gcd' === "gcd", this['gcd'] === this.gcdthis['gcd'] = function () {return a;};return a;},// Object property names can be specified by strings delimited by double (") or single (') quotes."lcm" : function () {// Variable names don't collide with object properties, e.g. |lcm| is not |this.lcm|.// not using |this.a * this.b| to avoid FP precision issuesvar lcm = this.a / this.gcd() * this.b;// Only need to calculate lcm once, so "redefine" this method.this.lcm = function () {return lcm;};return lcm;},toString: function () {return "LCMCalculator: a = " + this.a + ", b = " + this.b;}};//define generic output function; this implementation only works for web browsersfunction output(x) {document.write(x + "<br>");}// Note: Array's map() and forEach() are defined in JavaScript 1.6.// They are used here to demonstrate JavaScript's inherent functional nature.[[25, 55], [21, 56], [22, 58], [28, 56]].map(function (pair) { // array literal + mapping functionreturn new LCMCalculator(pair[0], pair[1]);}).sort(function (a, b) { // sort with this comparative functionreturn a.lcm() - b.lcm();}).forEach(function (obj) {output(obj + ", gcd = " + obj.gcd() + ", lcm = " + obj.lcm());});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。