Here you can find the source of fe(x)
//----------------------------------------------- // Floating point comparison //< returns true if approximately equal, false if not Number.prototype.fe = function(x) { var s = x.toString(); var point = s.search(/\./); /*from w ww . j a va2 s . c o m*/ // if not a floating point number if (point == -1) { return (Math.abs(this - x) < 0.5); // if x = 123 then [122.5 through 123.5] are true } else { var significantDigits = s.length - point; var epsilon = Number("5E-" + significantDigits); return (Math.abs(this - x) < epsilon); // if x = 0.12567 then [0.125665 through 0.125675)] are true } };
Number.prototype.div10 = function () { return this/10; Object.prototype.say = function (s) { console.log('I say ' + s); var o = {}; o.say("Hello"); var n = 120; ...
Number.prototype.double = function() { return this * 2; };
"use strict"; Number.prototype.doubleDigitalize = function() { const numberString = this.toString(); return numberString.length < 2 ? "0" + numberString : numberString; };
Number.prototype.equals = function (another) { return this - another === 0; };
Number.prototype.exp = function() { return Math.exp(this); };
Number.prototype.fillZero = function (len) var s = this.toString(10); while (s.length<len) s = "0" + s; return s;
Number.prototype.firstDigit = Number.prototype.firstDigit || function () { let number = this; while (number >= 10) { number = Math.floor(number / 10); return number; };
Number.prototype.fix = function (n) { var val = String(this); n = Math.abs(n); val = val.split('.'); val[1] = val[1] || ''; var m = val[1].length; if (m < n) { m = n - m; while (m > 0) { ...
Number.prototype.fizz = function() { return this % 3 === 0 ? "fizz" : ""; }; Number.prototype.buzz = function() { return this % 5 === 0 ? "buzz" : ""; }; for (var i = 1; i <= 15; i++) { var candidate = Number(i).fizz() + Number(i).buzz(); console.log(candidate ? candidate : i); ...