Adobe will not run custom Javascript
I'm trying to insert this code into the properties of a button to make my own toggle switch that will cycle between a checkmark and the numerals 1 through 5 upon each click. The Adobe JavaScript editor will not accept my code and gives me this error message: "SyntaxError: missing a ; before statement 1: at line 2". Here's my code:
let currentNumber = 1;
let isChecked = false;
function toggleCheckmark() {
if (isChecked) {
isChecked = false;
currentNumber = 1;
} else if (currentNumber === 5) {
isChecked = true;
currentNumber = 1;
} else {
currentNumber++;
}
if (isChecked) {
console.log("✓");
} else {
console.log(currentNumber);
}
}
Any suggestions?