Having problems with console.log

Hey, im having a problem with console.log at the moment. This is pretty much my first time learning console log and I don’t understand what’s going on here. Ive looked up lots of things trying to fix it myself but I can’t find a solution. what am I missing?

this is what my js file looks like:

let name = “tuscanny” ;

console.log(“name”);

please help.

this is what im getting in the console.

Right here, this says to log the string "name". You perhaps meant to log the contents of the variable name (no quotes).

1 Like

yes im expecting to do the console.log (“name”) and the name read as the variable “Tuscanny” .

You need to remove the quotation marks from around name.

yeah, ive tried that as well. when I do that I get this error message.

let name = “tuscanny” ; // 'name' is defined here. You need quotes around the string you want to use

console.log(“name”); // 'name' is used here. NO QUOTES!!!!
1 Like

Oh ok im getting it now. So this is what I get when I implement those changes. is this correct? the first line says tuscanny. is it only supposed to say this? are there no other identifying factors that tuscanny is a return value of a console log???

That’s the result I would have expected.

To be technical, "tuscanny" is not the ‘return value’ of console.log(). The string "tuscanny" was logged to the console. console.log() prints stuff to the console, but it does not have a ‘return value’.

ok I get that. that makes sense. Thanks for your help! this was actually driving me up the wall for a about and hr 30. :sweat_smile: I think my main lack of understanding was the quotations over name in the console.log. that was messing me up bad. Now I get that a string needs quotes when being defined, but the variable from there on will not use the quotes more or less correct?

1 Like

Yep. A string has quotes around it, but a variable name won’t!

1 Like

got it! thanks for your help!

1 Like

In addition to the taking out the quotes around the variable in the console.log, you were still getting an error with the curly quotes around your string. I changed them to straight quotes in testing that and got it to log correctly.

1 Like

Im still having issues with console.log on a to-do list tutorial that im working on… not sure why. It seems that If I define the variables inside the console, the console log will work but if I console log the variable in my editor I get an error saying the variable that im logging is not defined. Im very confused.

having problems with this.

when you have questions about some code, please share that code

1 Like

yes thank you.here is my code for the todo list that im working on. having problems getting it to work and have no idea why im having troubles counsel logging. its my first time doing console logs.

https://codepen.io/TuscannyCodes/pen/PobEXgZ

here is an image of how im attempting to console log with the console log at the very bottom.

Screen shots of code are not, in general, easy to work with.

here is what im getting in the console.