Is there a way to concatenate a string together to form an Anki field's name?

I am trying to create my own custom card and I was wondering if there was a way to add strings together to form a field name.

For example, let’s say I have some fields called ‘a1’, ‘a2’, ‘a3’, … ‘a8’. I wanted to do something like the following:

<script>
	for (let i=1; i <= 7; i++) {
			fieldValue = '{{a' + i + '}}';
			anotherFunction(fieldValue);
	}

</script>

I’m afraid not, as fields are replaced before Javascript runs.

2 Likes