Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions common-content/en/module/js1/variables/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,29 @@ Now it works!
The first line of this block is the variable **declaration**, the second line is a **statement**. Note that we don't need to use `let` again when reassigning the variable.

Knowing that something won't change can make it easier to write and reason about a program. We try to declare them with `const` wherever we can. But if a variable is going to need to change, we need to use `let` to declare it.

### Putting it into practice

You can use an LLM such as Claude or ChatGPT as an interactive tutor. For example, copy this prompt:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can use an LLM such as Claude or ChatGPT as an interactive tutor. For example, copy this prompt:
You could use an LLM such as Claude or ChatGPT as an interactive tutor. For example, copy this prompt:


```text
I am a {{<our-name>}} trainee learning JavaScript variables. Quiz me one question at a time about
const, let, declarations, reassignment, literals, and template literals. Use this example:

const name = "Alicia";
let greeting = "Hello";
console.log(`${greeting}, ${name}`);

Ask me to predict what the code prints and explain each concept. Give me hints before
revealing any answers.
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add a brief explanation of what this prompt will do: we're telling it to make a quiz about the concept we're learning here, with a specific goal to help us learn, not just give us information
or similar

#### Sample discussion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this just needs a bit of expansion - like here's an example of what you might see in the chat.


> **LLM:** What will the example print?
>
> **Learner:** `Hello, Alicia`.
>
> **LLM:** Correct. Why is `name` declared with `const`, while `greeting` uses `let`?
>
> **Learner:** `name` will not change, but `greeting` can be reassigned later.
Loading