Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript output crisis

Pavel

Well-Known Coder
Hello,



begining JS problem

i know little at this point :(

when i run my code on output i get A TON of confusing data

i am pretty sure it was fine in the last few days when i use console.log

plese see the image on the right

i am after the console running my code... and thats it :)

never mind the code itelf.. still learning

of note, months ago i installed node but un-intsalled it... same problem

help me , please :)



Screenshot 2024-04-12 163708.png
 
Hi there.
You may want to double-check your quotes. Are you sure there are supposed to be 2 single quotes before the comma?

This is where syntax highlighting is useful. What is orange is a string. You don't want + (year - birthYear) + to be a string, which looking at the colours, you can see it is.

You can also use a template literal like this:
JavaScript:
const Tim = `I'm ${firstName}, a ${year - birthYear} year old ${job}!`;
 
thanks!

i am new here :)

please be patient with me

installed Code Runner , vscode

i removed the string

got the following

[Running] node "c:\Users\Timothy Welch\Desktop\JS\complete-javascript-course-master\01-Fundamentals-Part-1\starter\more.js"
[Done] exited with code=0 in 0.268 seconds
[Running] node "c:\Users\Timothy Welch\Desktop\JS\complete-javascript-course-master\01-Fundamentals-Part-1\starter\more.js"
1978
[Done] exited with code=0 in 0.254 seconds

1978 comes from my variable const birthYear = 1978

i used console.log(birthYear);

what is all the other stuff? how do i remove it?

is there another way to run the code in VSCode?

THANKS!
 
OK!

i figured it out! :)

oubvioulsy i remove the bad string, it helps

i use code runner in VSCode

in its settings i can remove evrything BUT what i want

when i console log, its flawless... no superflous code... just what i want :)


crisis avereted!
 

Buy us a coffee!

Back
Top Bottom