Js code doesn't run on console tab google chrome


I get a blank instead of hello world

Hi there,
please post your HTML and JS code. You either haven’t linked that script correctly, or something inside your script is wrong.

Hi, this is what i’ve got exaclty as in the website they say Getting Started With JavaScript this is how i have it:


and the js file i have this:

console.log('hello world');
``` and i saved it as main.js

For one, you have a typo in your script element’s only attribute. Recheck the spelling of the attribute which is assigned the value main.js. Also, what does main.js look like? Finally, what exactly are you expecting your code to do that it is not?

Please post actual code instead of screenshots. To enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

The attribute is src, not scr

1 Like

Yes now it’s working, thanks a lot!!!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.