Skip to main content
Participating Frequently
June 17, 2020
Question

JavaScript variables don't work for me.

  • June 17, 2020
  • 5 replies
  • 5681 views

When I start any JavaScript code, inside of one HTML (<script></script>) or in a linked document .js

If I use let, show me this message:

ERROR: Parsing error: Unexpected token nombre.

 

If I use const, this is the message:

ERROR: Parsing error: The keyword 'const' is reserved.

 

For example:

let person1 = 'Charlie';

const valor1 = 5;

 

Console log also doesn't work:
Uncaught SyntaxError: missing } after property listmain.js:5:41note: { opened at line 1, column 14

 

Uncaught ReferenceError: person1 is not defined

    <anonymous> debugger eval code:1

debugger eval code:1:1

 

Don't have any relation about where I declare the variable or how, just avoid me to use let or const. I have Dreamweaver updated this morning. Anybody know about how to fix this??


Thanks!

    This topic has been closed for replies.

    5 replies

    Jon Fritz
    Community Expert
    Community Expert
    September 18, 2023

    Another DW user has found a fix for this issue. It involves a small change to the JS Linting source file in DW...

    1. Go to Site > Manage Sites and click the site you are working on to highlight it
    2. Hit Edit (pencil icon)
    3. Click Advanced Settings to expand the menu
    4. Click JS Lint at the bottom
    5. Click the Edit Configuration File button and add the following to the top of the file...

     

    {

        "parserOptions": {

            "ecmaVersion": "latest",

        },

        "env": {

            "es6": true

        }

    }

    5. Save and close the document (it may be necessary to restart DW as well). 

    (Edit: updated from previous version pointing to wrong file)

    B i r n o u
    Legend
    September 18, 2023

    although this may require more rewriting, wouldn't it be better to place these rules in the file reserved for JavaScript (site management, advanced options, JSLint) https://eslint.org/docs/latest/use/configure/#specifying-parser-options, and not in the one dedicated to HTML https://htmlhint.com/docs/user-guide/getting-started

    Known Participant
    September 18, 2023

    Birnou, you're exactly right... all the work has to be done in the js linting document, which is accessed, as you stated,  thru the manage sites. I'm so glad to get rid of that bug.

     

    RennoibAuthor
    Participating Frequently
    June 18, 2020

    So sadly and after don't find any solution. Finally I abandoned my try to learn and code JavaScript directly on DreamWeaver.  Literally is impossible to me work if for any cause, the variables don't works (I detected that also var cause me problems). And all this problems disappear magically when I use the same code on another software to coding.

    I hope that they fix it and also PHP possibles failures, because at side that the focus of this software in Front-End and work directly over visual design. If you want to work decently on a web or do something more professional, you need be avaible to execute at last, this two coding languagues.

    Thanks all for answer me and try to help me!

    Community Manager
    June 22, 2020

    Hi,

     

    Can you please share a screenshot of the html file where you have used your code mentioned above in <script> tag and also the screenshot of the error which you are facing.

     

    Regards

    Dreamweaver Team

    RennoibAuthor
    Participating Frequently
    June 24, 2020

    I send you captures. This web work perfectly in Visual Studio Code, but make a lot of errors in DreamWeaver. Happen with all JS pages or working inside of HTML with <script>.

     

    If is neccesary, I can make a shorter page, because most of the pages where I use, was for learn using the console and I don't saved them.

     

    Community Manager
    June 17, 2020

    Hi Rennoib

     

    Thanks for reporting the issue, could you please mention the Dreamweaver version you are using.

     

    Regards

    Dreamweaver Team

    RennoibAuthor
    Participating Frequently
    June 18, 2020

    Thanks for answer. The last that I could update. Also, sometimes, some keyboard shortcut like "Ctrl" + "/" don't work correctly until I reboot Adobe DreamWeaver. This problem only happen inside of this software.


    Version: 20.2

    Build 15263

     

    On Windows 10.

    Legend
    June 17, 2020

    Is there more to your javascript code than just the the let and const variable declarations as the console message suggests you are  missing a closing } bracket

    BenPleysier
    Community Expert
    Community Expert
    June 17, 2020

    To show what another IDE shows

     

     

    This makes me feel good because I know more than a dumb script editor.

     

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    Legend
    June 17, 2020

    Yeah, the ide recognises const but obviously does not know what it should be used for. Maybe its just putting it out there so you know it knows const is a reserved keyword for the fun of it.

    RennoibAuthor
    Participating Frequently
    June 18, 2020

    Nothing. Don't have any relation with brackets, funtions or anything. Any JavaScript wrote in anywhere, as simple as 1 line with: const = 1 or let = 1 this doesn't work. Only allow me to use "var", that is a problem precisely for that, I can't use local variables unmodifiable or inside of funtions due it.