JS code doesn't show up in inspect console?


I have downloaded visual studio code and Node to start JS on my mac. However, when I open this in chrome, my js doesn’t show in the inspect “console” section…I can’t figure out why as my chrome is up to date.

I have attached a screenshot :slight_smile:![13|690x243]

What’s currently there is what I’d expect to see (I’m on the console table and I can see the console), but you’re expecting something different - what are you expecting to see here?


I just deleted the js-basics folder that the html and js files were located in so the url won’t work now as I’m going to start all over again a bit later on.

I am following this youtube video: https://www.youtube.com/watch?v=W6NZfCO5SIk&t=670s&index=30&list=WL

at 11:37 he says that in the inspect console you should see “Hello World” message but when I try to recreate this, my console just shows “>” and a blank page. I was just wondering where I was going wrong?

Ah, I see. When you do start again, and if it isn’t working, can you paste that HTML here? Basically, what you’re seeing, the >, that’s just the console prompt, ie where you can type commands in, and as you’ve said, there should be a console.log statement printed out just before that, I think there’ll be a simple-to-fix error somewhere in the HTML

Yes- this is the html - you can see the js file is embedded but for some reason the console just isn’t showing it/linking it.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <h1>Hello World</h1>
    <script scr="index.js"></script>

this is the js that’s in the index.js thats in the same file- theres a lot of gibberish in there as I’m noting down the principles:

console.log('Hello World');

let name ='MOSH'; //string literal

let interestRate = 0.3;
interestRate = 1;

let age = 30; //Number literal

let isApproved = true; //Boolean Literal

let firstName;

let lastName =null;

Did screenshot instead as the html just translated in browser:

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


It does not show up, because you have a typo on the line below.

Ahhh! Thank you both! :slight_smile: