#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    1
    Rep Power
    0

    JavaScript math help please


    My site is coded in PhP and JavaScript and Mysql
    Code:
    Number.prototype.formatMoney = function(c, d, t){ 	var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0; 	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); };
    Can some one break that down for me. What is going on is the "quantity section of my site" when the Quantity/number is 4 digit number or grater it throws it into an NaN. any more questions feel free to ask. I just need to find out what quantity's bigger than a for digit number cause it to go NaN
    };
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    194
    Rep Power
    77
    Java and javascript are not the same thing and that is some poorly obfuscated javascript code but I still can't read it
    Last edited by jack13580; August 5th, 2013 at 11:39 AM.

IMN logo majestic logo threadwatch logo seochat tools logo