[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

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
0
tjyoung
Asked:
tjyoung
1 Solution
 
GaryCommented:
unique_opens_percent = unique_opens_percent.toString().replace("-", "");
0
 
tjyoungAuthor Commented:
Worked perfect Gary. Thanks very much. I'll leave you alone now :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now