Link to home
Start Free TrialLog in
Avatar of tjyoung
tjyoung

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tjyoung
tjyoung

ASKER

Worked perfect Gary. Thanks very much. I'll leave you alone now :)