Uncaught SyntaxError: Unexpected token ‘{’ at Cloudflare Workers JS

Viewed 26

I really need help. Iʼm working on a project on Cloudflare Workers, Iʼve been using Workers for a long time, but this is the first time Iʼve run into a serious problem. When I was going to save and deploy my Workers a warning popped up “Uncaught SyntaxError: Unexpected token ‘{’ at worker.js:107:248 (Code: 10021)” , and it prevented me from saving it. This is the line of code where my error is:

function setClass(selectedClass){const classButtons = document.querySelectorAll('.class'); classButtons.forEach((button) => {if (button.classList.contains('active')) {button.classList.remove('active');}}) let activeClass = document.querySelector(`.class-${selectedClass}`); activeClass.classList.add('active');}

at

document.querySelector(`.class-${selectedClass}`)

Curly brackets or braces ({) or grave accent or backtick (`), I donʼt know. I donʼt understand, because on my website it works very well. Please help me, itʼs been 3 days I canʼt solve the problem.

0 Answers
Related