This function redirects to a URL, but the course_syllabus_code
part shows up as undefined
after the URL. I don’t know why this happens.
Basically the user will be able to open the code and enter the variables (there will be multiple) at the top. Then further below is where all the magic is supposed to happen.
The structure of the variable being entered cannot change but maybe the “magic” isn’t being executed in the best way possible.
const course_syllabus_code = "72524";
function syllabusLink(course_syllabus_code){
location.href = "https://example.com/" + course_syllabus_code;
}
<ul>
<li>
<a href="javascript:syllabusLink();">Syllabus</a>
</li>
</ul>