# Anki renders my card templates only once

**URL:** <https://forums.ankiweb.net/t/anki-renders-my-card-templates-only-once/23974>\
**Category:** Help\
**Created:** [October 17, 2022, 4:35pm UTC](https://forums.ankiweb.net/t/anki-renders-my-card-templates-only-once/23974 "2022-10-17T16:35:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [October 17, 2022, 5:38pm UTC](https://forums.ankiweb.net/t/anki-renders-my-card-templates-only-once/23974/2 "2022-10-17T17:38:54Z")

</div>

You’re probably getting this SyntaxError:  
[Identifier has already been declared Error in JavaScript | bobbyhadz](https://bobbyhadz.com/blog/javascript-identifier-has-already-been-declared#:~:text=The%20%22Identifier%20has%20already%20been,single%20time%20in%20a%20scope).

Make sure to use `var` instead of `let` and `const` in the global scope (outside of functions) or wrap your scripts in IIFEs.

* * *

> [@Conditional formatting (with JavaScript) doesn't work anymore](https://forums.ankiweb.net/t/conditional-formatting-with-javascript-doesnt-work-anymore/16797/4):
>
> The \<script\> will be executed every time, you go to the next card, but in the same context. If you use a let assignment with the same identifier (quoteanswer in this case) multiple times, JavaScript will complain, that "quoteanswer has already been defined". However, with var, you’re allowed to redefine the variable. TLDR, because this is valid JS: var a = 5; var a = 10; // OK: a is now 10 but this is not: let a = 5; let a = 10; // ERROR: a has already been defined

---

_[View the full topic](https://forums.ankiweb.net/t/anki-renders-my-card-templates-only-once/23974)._
