JS code doesn't show up in inspect console?

JS code doesn't show up in inspect console?
0

#1

Hi,

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:

http://127.0.0.1:5500/index.html![13|690x243]


#2

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?


#3

Hi,

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?


#4

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


#5

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">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h1>Hello World</h1>
    <script scr="index.js"></script>
</body>
</html>

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
console.log(name);

let interestRate = 0.3;
interestRate = 1;
console.log(interestRate);

let age = 30; //Number literal

let isApproved = true; //Boolean Literal

let firstName;

let lastName =null;

#6

Did screenshot instead as the html just translated in browser:


#7

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.


#8

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


#9

Ahhh! Thank you both! :slight_smile: