Alright, thanks for your help on this one, mwilson. After a bit of experimentation, the scenario is now a lot clearer.
This code works and renders correctly:
<script>
const const_nativeToForeign = "nativeToForeign";
const const_foreignToNative = "foreignToNative";
js_currentPointInTestCount = "{{flask_currentPointInTest}}";
js_totalWordsInTestCount = "{{flask_totalWordsInTest}}";
js_totalCorrectOnFirstTryCount = "{{flask_totalCorrectOnFirstTryCount}}";
js_totalCorrectOnSubsequentTryCount = "{{flask_totalCorrectOnSubsequentTryCount}}";
js_totalGiveUpsCount = "{{flask_totalGiveUpsCount}}";
js_actionToTake = "{{flask_actionToTake}}";
//js_translationDirectionOfTest = "{{flask_translationDirectionOfTest}}";
js_translationDirectionOfWord = "{{flask_translationDirectionOfWord}}";
js_nativeWord = "{{flask_NativeWord}}";
js_foreignWord = "{{flask_ForeignWord}}";
js_nativeWord = "{{flask_NativeWord}}";
js_foreignWord = "{{flask_ForeignWord}}";
JSON_list_direct_object_genders = {{ flask_JSON_list_direct_object_genders | tojson }};
JS_list_direct_object_genders = JSON.parse(JSON_list_direct_object_genders);
console.log(JS_list_direct_object_genders);
JSON_list_special_chars = {{ flask_JSON_list_scs | tojson }};
JS_list_special_chars = JSON.parse(JSON_list_special_chars);
console.log(JS_list_special_chars);
document.getElementById("btnMoveIt").disabled = true;
document.getElementById("textGuessInput").focus();
...but this code does not render (note the additional commented out line):
<script>
const const_nativeToForeign = "nativeToForeign";
const const_foreignToNative = "foreignToNative";
js_currentPointInTestCount = "{{flask_currentPointInTest}}";
js_totalWordsInTestCount = "{{flask_totalWordsInTest}}";
js_totalCorrectOnFirstTryCount = "{{flask_totalCorrectOnFirstTryCount}}";
js_totalCorrectOnSubsequentTryCount = "{{flask_totalCorrectOnSubsequentTryCount}}";
js_totalGiveUpsCount = "{{flask_totalGiveUpsCount}}";
js_actionToTake = "{{flask_actionToTake}}";
//js_translationDirectionOfTest = "{{flask_translationDirectionOfTest}}";
js_translationDirectionOfWord = "{{flask_translationDirectionOfWord}}";
js_nativeWord = "{{flask_NativeWord}}";
js_foreignWord = "{{flask_ForeignWord}}";
js_nativeWord = "{{flask_NativeWord}}";
js_foreignWord = "{{flask_ForeignWord}}";
JSON_list_direct_object_genders = {{ flask_JSON_list_direct_object_genders | tojson }};
JS_list_direct_object_genders = JSON.parse(JSON_list_direct_object_genders);
console.log(JS_list_direct_object_genders);
// JSONsomethingMeaningless = {{ flask_JSON_something_not_defined_in_python | tojson }}
JSON_list_special_chars = {{ flask_JSON_list_scs | tojson }};
JS_list_special_chars = JSON.parse(JSON_list_special_chars);
console.log(JS_list_special_chars);
document.getElementById("btnMoveIt").disabled = true;
document.getElementById("textGuessInput").focus();
...because the variable flask_JSON_something_not_defined_in_python was not defined in the return render_template() of the Python file.
Even though the offending line is commented out, it still won't render. That's fine (although very odd - but you have given me an explanation and I'll look into the links you provided so thanks for those).
Delving a bit deeper, if the commented out line is changed to:
// JSONsomethingMeaningless = {{
then it still won't render (so it must be detecting jinja here? Possibly because of the double-chain brackets?)
If the commented out line is changed to:
// JSONsomethingMeaningless = {
i.e. just a single chain bracket, the HTML file renders without a problem and does everything I expect it to do (in terms of being able to use the variables, etc).
So the moral of the story seems to be that comments are not really comments if the HTML file rendering picks them up as lines of Jinja?
And the other moral of the story is that I should pay more attention to what I have defined in the render_template() part of Python!
Thanks again for your help and I will check out those links. I'm coming from a world of Cobol and Delphi (server/client) so this is all a bit new to me!