Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
I am working within a Learning Management System and creating some custom components
This is returning the url but the "course_syllabus_code" shows up as undefined after the url. I am a beginner to Javascript and have looked at some of the other answers on Google but still cannot figure it out.
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.
href="javascript:syllabusLink()"> src="CourseButton3.png" />Syllabus
You're passing course_syllabus_code as an argument to the function, but calling the function without any arguments. When you call a function with fewer arguments than it defines, the ones that you don't pass come through with the value undefined. Since you've given the function argument the same name as the global, it "shadows" (obscures, hides) the global from the code in the function, which will access the argument instead.
course_syllabus_code
undefined
You have three choices (only do one of these, not all of them):
Use the global by just removing the declared function argument:
function syllabusLink() { // Removed here ------^
Or, pass the global into the function where you call it:
href="javascript:syllabusLink(course_syllabus_code)"> src="CourseButton3.png" />Syllabus
I'd probably change the name of the argument as well (here I've used scode):
scode
function syllabusLink(scode) { location.href = 'https://foo.com'+scode; }
Or, don't make course_syllabus_code a global at all, and pass it to the function:
href="javascript:syllabusLink('72524')"> src="CourseButton3.png" />Syllabus
I'd probably go for #3, unless there's a really good reason it has to be a global variable.
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.