I have a function in JavaScript
function functioncalled(){
var result = 1;
var activityID = {{ mynames[result][8] }};
console.log(activityID);
}
mynames is a list of lists in Flask template. The above code fails giving me an error - UndefinedError: list object has no element Undefined. But when I access the list element using var activityId = {{mynames[1][8]}} everything works fine. How do I make this work? Is there a workaround? I couldn't find the solution anywhere.