So I have a var with value in digits and i want to add '=' sign at the third last position such that
var num = 98564;
would become
985=64
by googling I came accross this function
String.prototype.insert = function (index, string) {
if (index > 0)
return this.substring(0, index) + string + this.substring(index, this.length);
else
return string + this;
}
I think it will do my job, but I also want to keep a condition that
if var num = 98;
(2 digits) then the output should be 0=98
can you help me modifying that function? also guide me to do the same in PHP (any inbuilt function that you know?) Thanks!