It’s because AnkiDroid rebuilds the document on each card flip, whereas Anki Desktop persists the document.
var can be redeclared, but const or let cannot. That means as soon as you flip the card, there will be an error if a variable is already defined with one of these keywords.
Here’s a more detailed explanation (the statement about 2.1.41 is wrong, as Damien commented below):