The following function takes two numbers that are linked with a "user" and calculates an ID number based on that. I have been trying to make this as clean as possible, and would like some advice on how to make this more efficient. an example of the input would be "12195491" for the num and "3120" for the ts, which would output "8511"
function getidnumber(num, ts) {
num = num.substr(4, 4);
ts = ((ts == undefined) ? "3452" : (ts));
var _local5 = "";
var _local1 = 0;
while (_local1 < num.length) {
var _local4 = Number(num.substr(_local1, 1));
var _local3 = Number(ts.substr(_local1, 1));
var _local2 = String(_local4 + _local3);
_local5 = _local5 + _local2.substr(_local2.length - 1);
_local1++;
}
return("@user" + _local5);
};
"3452"
? Why as a string not a number? What ists
? \$\endgroup\$