Trying to use .replace to get rid of a minus sign if present, but not working

HI,
I seem to be getting a 'not a function' error when using this line in the code below:
unique_opens_percent = unique_opens_percent.replace("", "-");

I'm trying to remove a dash/minus sign that may be in the unique_opens_percent variable.
Any idea where I'm going wrong? If I take out the line, the rest of the code works fine.


var unique_opens_percent = data.campaign.unique_opens / (data.previous_campaign.campaign.unique_opens/100) - 100;
	unique_opens_percent = unique_opens_percent.replace("", "-");
	unique_opens_percent = unique_opens_percent.toFixed(0);

Open in new window


Thanks for any help.
tj
LVL 1
tjyoungAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
unique_opens_percent = unique_opens_percent.toString().replace("-", "");
0
 
tjyoungAuthor Commented:
Worked perfect Gary. Thanks very much. I'll leave you alone now :)
0
All Courses

From novice to tech pro — start learning today.