Basic JavaScript: Declare JavaScript Variables need help writing

Tell us what’s happening:
I cant get pass this even though im doing the right thing? Help?

Your code so far
Screen Shot 2020-08-10 at 12.50.16 PM


var myName="Matthew";

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Declare JavaScript Variables

Link to the challenge:

You are not only declaring a variable but also assigning it to a string.

An example of a declared variable would be var heyMatthew;

In general:

var variableNameHere;

So my javascript should be var heyMatthew; right?

Read it again, made an edit accounting for that :slight_smile:

wut you mean???//

var variableNameHere;

Replace variablenameHere with the variable name they are giving you (myName). Is it better now?

1 Like

it doesnt work. OKAy so i put in var variable"Matthew" with and without the quotes and it still doesnt work and i put in the semicolon

just give me yours
and i just change the name thanks

It’s important to differentiate what is what. A variable declaration is this:

var myName;

Don’t assign it. Just write that, and see if it passes.

Once you pass, review the previous replies I’ve made, you’ll get the idea much better :slight_smile:

1 Like

Oh im so stupid i though that i need to write My Name like my name
Thank you so much

You’re not stupid, it’s just practice and time. Ask me whenever you need help.

1 Like

i just started Javascript i wanna become computer programmer, or software developer, or cryptographer or cryptoanalys

thank you again very much

Here’s how I look at it:

  1. When you write “var”, that creates a container.
  2. When you write “var myName,” you added a label to the container.
  3. When you write “var myName = ‘Cheryl’”, there is now a string ‘Cheryl’ inside the container labeled myName.
2 Likes

I love it thank you very much.

You have been told to declare a variable.
Let us use a metaphor. You are told to buy a box into which you intend to store some books. So buy the box using var, then name(myBooks) it so that you can easily identify it, E.g var myBooks.
You have successfully bought a box(var) and named it(myBooks).
That’s same as declaring a variable.

2 Likes

A post was merged into an existing topic: Declare JavaScript Variables 2