sayHello gives Uncaught ReferenceError: sayHello is not defined error

The javascript

<html>

    <head>
        <script type="text/javascript" src="script.js"></script>
    </head>

    <body>
        <button onclick="sayHello('world')">Click Me</button>
    </body>

</html>

gives a Uncaught ReferenceError: sayHello is not defined error.

The above is HTML, not JavaScript. Please post your script.js code.

const sayHello = phrase => console.log(`Hello $(phrase}!`);

Hi Roy,

I haven’t got access to the script.js file I am only on the first exercise in the HTHL + Javascript +css course the script.js file is slready meant to be there in the same directory as the HTML file see https://www.codecademy.com/en/courses/htmljavascript-css/0/2

Best Regards,

Jonathan

HTML + Javascript + CSShttps://www.codecademy.com/en/courses/html-javascript-css/0/2
www.codecademy.com
We’ll add Javascript and CSS to HTML to see how to make an interactive webpage.

That is the old learning environment, which is no longer supported.

There might be bugs in that course, i would advise against taking this course. Go to codecademy main site (link) and pick one of the supported courses please

Hi,
There is no equivalent course on HTML Javascript and CSS I am trying to get ready for an intermediate course in WordPress. Can you recommend another course?
Best Regards,
Jonathan

There is a html course:

https://www.codecademy.com/learn/learn-html

a css course:

https://www.codecademy.com/learn/learn-css

and a JS course:

https://www.codecademy.com/learn/learn-javascript

which near its end features Jquery and DOM manipulation, the rest of the course focus on learning JS itself, JS is a tricky language on its own, let alone if you get the DOM involved.