sayHello gives Uncaught ReferenceError: sayHello is not defined error


The javascript


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

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


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

Best Regards,


HTML + Javascript + CSS
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


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,


There is a html course:

a css course:

and a JS course:

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.