Skip to main content
New Participant
June 29, 2021
Question

console.log("Hello World");

  • June 29, 2021
  • 3 replies
  • 4651 views

I tried to write the script tag console.log ("Hello World") in DreamWeaver CC 2021, but didn't work. Appeared the follow message:  ERROR: Unexpected console statement. [no-console]. Why is this happened?

    This topic has been closed for replies.

    3 replies

    BenPleysier
    Community Expert
    June 29, 2021

    Try the following:

     
    HTML:
    <!doctype html>
    <html>
    
    <head>
        <meta name="ac:base" content="/test-php">
        <base href="/test-php/">
        <meta charset="UTF-8">
        <title>Untitled Document</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    </head>
    
    <body id="index">
    
    
        <script src="myjs.js"></script>
    </body>
    
    </html>

     

    The Javascript file called `myjs.js`:

    console.log("Hello World")

     

    Then view the file with the console tab selected and see

     

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    B i r n o u
    Community Expert
    June 29, 2021

    yes you're right, the console object use to work in Dreamweaver, but as soon as the chrome engine become editable in live view, I think that the team remove this feature.

    it was displaying the output in  the result panel (Site Report) as you can see in this tutorial

    https://www.linkedin.com/learning/l-essentiel-de-dreamweaver-cc-2013-5-flux-de-donnees-et-interactivite/utiliser-la-console-integree

     

    New Participant
    June 29, 2021

    Thank you, osgood_ ! Thank you, Nancy OShea! Thank you, Birnou! The Adobe's coder said to me, in the chat, that console is a global, not a universal, 'cause this doesn't works in DreamWeaver.

    Brainiac
    June 29, 2021

    console.log() is what is output to the 'browser' console and can be viewed by using the browser devtools or does DW have its own terminal window where you are trying to output javascript code?

    New Participant
    June 29, 2021

    os good_

     

    I think so. But I Am begginer in JavaScript, and all the tutorials that I've read teach that I must to write this tag all the time, in the code. How must I run the code, in Preview in Browser?

    Nancy OShea
    Community Expert
    June 29, 2021

    Dreamweaver is first & foremost an HTML code editor. 

    Start with an HTML document.  Go to File > New > HTML > hit the Create button.

    Add JavaScript between the <script> tags inside your HTML document.

    Use Ctrl/Cmd + S to save.

    Preview in your favorite browser (F12).

     

    Example:

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8">
    <title>JavaScript Test</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
    <h1>Heading 1</h1>
    <h2>Heading 2</h2>
    <p>Lorem ipsum dolor...</p>
    <hr>
    <script>
     alert( 'Hello, world!' );
    </script>
    </body>
    </html>

     

    Hope that helps.  🙂

     

    Nancy O'Shea— Product User, Community Expert & Moderator