If that great mess of JavaScript is what you actually have, and you’re trying to access the variable merit
from your HTML file, you can’t: merit
is scoped inside a function, and unavailable outside of that function.
You could make it a global like a large portion of your other variables, this would solve the immediate problem, assuming your JS is processed before anybody clicks.
That is a giant hunk of very-similar JS; I might reconsider your code’s organization.
1
solved Declared variable but can’t reach it from HTML