"let" or" const" variables are not allowed with an expression?

Hi fellow Bubblers,

I have a question regarding the use of HTML element .

I recently started to make use of tag in the HTML element, but I noticed that having “const” or "let " variables are causing a some error in the console.

Here is the simple problematic script.

スクリーンショット 2020-08-09 11.26.17

This is the error in the console.

スクリーンショット 2020-08-09 11.30.38

I can avoid this error by deleting the expression or by using “var” instead.
But this is not ideal…

I am still newbee in Javascript world.
Is it a limitation of bubble ?


It’s likely because of this phenomena:

It runs twice, but at the second time the variable has already been declared.
Edit: So yeah, erasing or using var is the way to go.


I didn’t know any of that.
Thanks @vini_brito !

I read the manual you linked for me.
I managed to find a way to keep the “let” or “const” in the script.

スクリーンショット 2020-08-09 15.22.57

So, I wrapped the code with 'try…catch ’ method.

1 Like