I am taking a Javascript course by Udacity. The project is to build a resume. Neither the course nor another question really answers my question.
There is a resumeBuilder.js file, and a helper.js file. The helper.js file contains variables with strings that need to be replaced, such as %data%.
I modified one of the variables myTwitter to myWebsite and added an HTML tag to open my website in a new tab.
In the resumeBuilder.js file, I have these variables:
var myWebsite = HTMLwebsite.replace("%data%", "http://learn.website.com");
myWebsite = HTMLwebsite.replace("%website%", "www.website.com");
...which are supposed to replace the strings in this variable in helper.js:
var HTMLwebsite = '<li class="flex-item"><span class="orange-text">website</span><span class="white-text"><a href="%data%" target="_blank">%website%</a></span></li>';
On the index.html page, the website and link appear; however, when I click on the link for www.website.com, it opens a new tab in my browser (Firefox) but takes me to a local file path ending in '%data%' such as:
file:///C:/Users/user/Documents/Education/Javascript/udacity/git_repos/frontend-nanodegree-resume/%data%
When I hard-coded helper.js' variable to the following, it directed me to the URL I wanted:
var HTMLwebsite = '<li class="flex-item"><span class="orange-text">website</span><span class="white-text"><a href="http://learn.website.com" target="_blank">%website%</a></span></li>';
I would like to know how to not hard-code helper.js and use the replace method in resumeBuilder.js to make the URL work.
I also tried adding \ next to / and : characters, and changing %data% to \"%data%\" in helper.js and resumeBuilder.js but that did not fix it.
Thank you!