I'm having some issues with my code when calling a function from another script. When I send the data over the variable adds a 1. Is there away to get the value from the last 2 digits and remove 1 from them and then merge them into the main int again?
Where I'm calling the function: (test.js):
cards.getcards(76561198089544929, function(err, res, body){});
Inside the script with the fucntion (index.js):
exports.getcards = function(steamid, callback){
console.log(steamid);
}
Output: 76561198089544930
FIX
var steamid = 76561198089544930; //This is what I got from the function.
var toText = steamid.toString(); //convert to string
var lastChar = toText.slice(-2); //gets last character
var baseChars = toText.slice(0, -2);
var lastDigit = +(lastChar); //convert last character to number
var newlast = lastDigit - 1;
var steamid = baseChars+newlast;
alert(steamid);