Hi @NatFeibish,
I second what @matthew_buckett wrote. Once you get past making cosmetic changes to the Canvas UI, custom JavaScript in your Canvas instance is usually not the best way to go, and it becomes time to look into alternative solutions. LTI Advantage is definitely the best option for a custom integration that involves updating grades, but at that point, you will be getting into the weeds of web app development. There is a lot to learn, so I would encourage you to investigate "off the shelf" solutions before diving into LTI development.
There are companies dedicated to creating custom LTI solutions (Unicon, Atomic Jolt, Instructure's Professional Serivices, etc.) due to the technical knowledge required to create them and safely deploy them to users. An LTI, just like any other publicly accessible website or web app, will be hosted on a server or cloud provider and will be accessible to the entire web. You will need to make sure it is secured using the most up-to-date cybersecurity practices to ensure any stored user data does not leak. The actual steps you take for this depend on where you host the LTI (i.e. Amazon Web Services, Heroku, or your own virtual private server).
You may consider looking into Adobe Captivate, Articulate Storyline, HP5, or iSpring as low-code solutions that can add interactivity to your courses without the need to dive deep into building out a web application that conforms to the LTI Advantage specifications. Most of these solutions, such as Captivate and Storyline, can be integrated into a course via SCORM, which is usually as simple as publishing a project in one of these apps as a zip file and uploading that file to Canvas.
It is certainly worthwhile learning the Canvas API because it allows you to do many things that the UI does not do. However, that alone will not show you how to do what you are asking about. Your custom JS will not be able to safely communicate with the Canvas backend to update grades as it currently stands. The problem is that your custom JS is running in the student's browser when they are completing the flashcards and quizzes. Therefore, your JS code can only "authenticate" itself as the student via passing along the CSRF session token or generating access tokens on behalf of that user, but the student will not (and should not) have access to update their own grades, so your JS will not be able to work with the Canvas API to update grades in either case.
This brings us to the LTI solution. An LTI is it's own web app hosted on another server. When a user opens your LTI in Canvas (either by clicking a link in the course navigation, a link in a module, or a link embedded via the Rich Content Editor), Canvas will launch the app in an iframe within Canvas or in a new tab. In this process, Canvas and your LTI do an authentication "handshake" following the OAuth specification. This handshake tells your LTI who is using it so it can track that student's progress. Your LTI can then update that student's grades via the permissions it was granted from the LTI key that a Canvas admin had to add to Canvas. That LTI key is like a Canvas administrator's stamp of approval that lets Canvas know that the LTI is allowed to make certain updates in Canvas according the the LTI Advantage specification. Students can complete the flashcards in your LTI while the LTI has permissions to update grades because an LTI key had to be added to the Canvas instance by a Canvas admin. If you want to see an example of what the code for an LTI looks like, Unicon has the starter code for a Java Spring Boot implementation on their github, and Instructure has a similar starter implementation written in Ruby. These code repositories are what would be built into the server-side application that would run on the cloud/hosting provider of your choosing.
I am writing all of this not to overwhelm you, but so you know what you are getting yourself into. Once again, I do suggest looking at some of the other "off the shelf" solutions I mentioned. Chances are that you will find at least one of them will be able to replicate similar interactivity to what you desire. It may not be exact, but it will be much easier to deploy to users.