Week 3 - Functions and strings

Functions

String functions

JavaScript Modules

Scope

IDE navigation

DRY (Don’t Repeat Yourself)

Function size

Using LLMs for efficient learning

Practice

Assignment

Back to core program

Using LLMs for Efficient Learning

Large Language Models (LLMs) like ChatGPT, Claude, and others have emerged as powerful companions in the learning journey, particularly for programming and software development. These tools can provide instant explanations for concepts you're struggling with, generate custom code examples tailored to your specific needs, and offer debugging assistance when you're stuck on an error. They're available 24/7, allowing you to learn at your own pace so 100% make use of it.

<aside> ❗

LLMs LIE. They can generate information that sounds completely plausible but is actually incorrect, outdated, or even entirely fabricated, a phenomenon known as "hallucination." An AI might confidently explain a JavaScript function that doesn't exist, or provide syntax that was deprecated years ago, all while sounding authoritative and helpful.

</aside>

This limitation means you should always approach AI-generated information with a healthy dose of scepticism. Cross-reference explanations with official documentation, test code snippets yourself before incorporating them into your projects, and verify facts through trusted educational resources. The AI's training data has a cut-off date, which means it may not be aware of the latest updates to programming languages, frameworks, or best practices. Additionally, without sufficient context about your specific project or learning goals, the AI might provide solutions that are technically correct but not appropriate for your situation.

Watch the video below from a learning expert going over his thoughts on ChatGPT Study Mode (which is a specific version of ChatGPT). Not necessarily to use it, but because he nicely explains the pitfalls of learning with LLM. We will summarise the important parts below it.

https://www.youtube.com/watch?v=m3jNwwuvqx8

LLMs are an aid

The key to using LLMs effectively is to treat them as learning aids rather than answer machines. Instead of simply asking for solutions to your assignment problems, use AI to deepen your understanding of underlying concepts. When you receive a code example from an LLM, don't just copy and paste it or even worse let it write the code as well.

<aside> 💡

While learning, always type code out yourself to build muscle memory, then experiment with modifications to see how changes affect the output. Ask specific follow-up questions about why something works the way it does.

</aside>

Be an active learner

It is really easy to become a passive learner when using LLMs. A passive learner doesn’t interact with the LLM and just follows the suggestions of it. If you don’t understand something, think to yourself what part you are struggling with and ask detailed questions back. An LLM cannot judge where you are going wrong like a teacher would so you need to be clear on how the LLM can help you.

Ask LLMs for exercises/tests

Luckily there are thousands of examples on the internet as programming has a lot of open source information which mean LLMs are able to help create practice content for you. So let it generate some exercises/tests you so you can try to solve them yourself. If you are stuck, ask it for hints to maybe get you over the hump. This way you have an endless bank of practice exercises to hone your skills.

Prompting

Depending on what LLM you use you may need to do some prompting to get it to react the way you want it to. Remember that LLMs are usually used to find quick answers and not really built to be learning tools. To avoid getting the answers and have it act more like a tutor here are some example prompts to get you started. Notice that every prompt is generally structured as You are a [llm-role], I am a [role]. [question]. Use [type]. Experiment with it, remember to be an active learner.

<aside> ⚠️

As these tools move so fast things may work a little differently by the time you read this so if you aren’t getting the result you want, have a look at some more recent information on this on the internet.

</aside>

Explain a topic

You are a JavaScript teacher and I am a beginner trying to learn JavaScript. Explain <write topic> in JavaScript. Use an analogy and some examples, then quiz me at the end.

Some other learning types you can ask it to use are: ‘Explain it like I am 12’, ‘Use diagrams’, ‘Use a flowchart’.

Help debugging

You are a senior JavaScript developer and I am a beginner trying to learn JavaScript. The following code is not working, I am getting the error <error>. Do not fix the issue, but give me a hint on how I should proceed. <paste code>

Again, you don’t want it to just fix it but you want to get that nudge to be unstuck on the problem so that you can learn. Debugging is one of the most valuable skills of a developer so make the LLM help you train it.

Ask for feedback

You are a senior JavaScript developer and I am a beginner trying to learn JavaScript. I wrote the following code to solve <the problem>. Provide feedback on this code, telling me where you would consider a different approach and explain what advantages/disadvantages that approach has.

This one you should be a little wary of as it may go into quite advanced topics that we will only go into later on, but don’t be scared to see what it says and think about it.

Generate an exercise/quiz

You are a JavaScript teacher and I am a beginner trying to learn JavaScript. I have just learned <topics>. Generate a few exercises for me to test my knowledge on these topics.

Or say Generate 10 multiple choice questions for me


The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 **

CC BY-NC-SA 4.0 Icons

*https://hackyourfuture.net/*