JAVA script. section six

When a variable is declared with the let keyword, you can reassign (or change the value of) that variable later on. In this example, the value of programmer is changed from "Naomi" to "CamperChan".
Example Code

let programmer = "Naomi";
programmer = "CamperChan";

Note that when reassigning a variable, you do **not** use the `let` keyword again.
After your `console.log`, assign the value `"World"` to your `character` variable.


Does any one know how to do this step? Thanks for everyones' help :grinning:

THanks for everyonesā€™ help

Hi, :wave:

Can you fix your post to only wrap code in code blocks, please. It makes it a lot easier to read.

Specifically what is it that you donā€™t understand or need help with?

Youā€™ve demonstrated here that you know how to reassign a value to a variable ( as you did with programmer = "CamperChan"; )

Sorry I dont know how to do that. This is section 6 in Java script. but also thanks

Be as specific as you possibly can when asking for help from people.

  1. What is not working?
  2. What are you trying to achieve?
  3. What are you seeing on screen? Any feedback or errors?
  4. Also, you donā€™t know how to do what? Fix your post or reassign a variable?

Please answer all of the above questions, and Iā€™ll be happy to help you figure it out.

Welcome to the forum @Jks

From step six of the Pyramid Generator practice project.

After your console.log , assign the value "World" to your character variable.

Have a look at the example code on how to assign a string to a variable.

Happy coding

Iā€™m sorry I didnā€™t make it clear.

  1. My code shows errors, this is my code:
    let character = ā€˜Helloā€™;
    console.log(character);
  2. I want to assign the value"world"to my character variable.
  3. The feedback error is I should useā€™characterā€™ twice.
  4. ah, I donā€™t know how to fix my code, im new be here.
1 Like

after your console line , assign "World" to your character variable without let keyword.

1 Like

Thanks for clear update. Let me explain some concepts around what youā€™re tying to accomplish.

  • The let keyword just declares (creates a new) variable.
  • The = operator assigns a value to it.

So, you can do that in 2 steps like:
let name; // declared a variable name, but it has no value yet. (undefined).
name = "Steve"; // assign the value ā€œSteveā€ to it

You can also do this in one step:
let name = "Steve"; // created a variable called name with the value ā€œSteveā€

Now, if you log that to the console ( with the console.log function)
console.log(name); // You will see Steve

At this point, if you want to change the value of name, you can just assign another value to overwrite ā€œSteveā€ like this:
name = "John";

So, to verify that youā€™ve changed name to have a new value, John, you can console log name again;
console.log(name); // Now you will see John

1 Like

Thank you so muchļ¼ I understand it. :fist_right:

2 Likes