Mentor AI

Your personal JavaScript mentor, right where you learn

Mentor AI works alongside you across RealJS. It sees the tutorial, lesson, or exercise you’re on, knows what you’ve been learning, and helps you understand, practice, and keep moving forward.

Join

Mentor AI is available to members. Already a member? Sign in

Mentor AI

Hi, I’m Mentor AI. I’m with you on every page of RealJS, and I can see you’re reading about map(). Ask me anything about it.

Why would I use map() here instead of a plain for loop?
Reading “JavaScript's Array map(): Transforming Arrays Without a Loop”

Fair question, and the honest answer is that on this example you might not. The code above does the same as:

Language: JavaScript
const squared = [];
for (const n of numbers) {
  squared.push(n ** 2);
}

map() earns its place when you think in terms of the result. It gives you a new array and leaves the original alone, so there’s no empty array to set up and fill by hand:

Language: JavaScript
const names = ["ada", "grace"].map((name) => name.toUpperCase());
Want to keep going?

You can, and that’s where it really shines. Because map() returns a new array, you can call the next method right on the result:

Language: JavaScript
const evenSquares = numbers
  .filter((n) => n % 2 === 0)
  .map((n) => n ** 2);

It reads top to bottom: keep the even numbers, then square them. filter() is covered further down this page, so keep reading and I’ll be here if anything is unclear.

Works wherever you learn

  • Tutorials
  • Video courses
  • Exercises
  • Quizzes
  • Learning paths
  • JavaScript reference

Get unstuck

Help the moment you’re stuck

A failing test, a confusing error, or a concept that won’t click can stall you for an hour. Mentor AI sees your exercise, your code, and your test results, then guides you toward the fix one hint at a time.

You still get to solve it yourself, and you come away understanding why it works.

Try it with Mentor AI

Mentor AI
My test keeps failing and I don't see why.
Looking at your exercise attempts

You’re close! Your function counts every word correctly, but the failing test has both "The" and "the" in it and expects them to count as the same word.

Here’s a nudge instead of the answer: what could you do to each word before counting it, so that capitalization stops mattering?

Oh! Make everything lowercase first?

Exactly. Call .toLowerCase() on the text before you split it, then run the tests again:

Language: JavaScript
for (const word of text.toLowerCase().split(" ")) {
  counts[word] = (counts[word] ?? 0) + 1;
}

If the next test trips over punctuation like javascript, versus javascript, let me know and we’ll figure that one out together.

Go deeper

Ask about anything you’re reading

Highlight a sentence in a tutorial, a lesson, a quiz, or a reference page and ask about it. Mentor AI reads the same page you’re on, so its answers build on what’s in front of you.

Ask for another example, a simpler explanation, or how an idea connects to something you already know, and keep going until it clicks.

Try it with Mentor AI

Mentor AI
“even after the outer function has returned”
How can the inner function still see the variable if the outer one already finished?
Reading “JavaScript Closures Explained”

Because the inner function keeps a reference to the scope it was created in. As long as something can still call that inner function, JavaScript keeps its variables around:

Language: JavaScript
function makeCounter() {
  let count = 0;
  return () => ++count;
}

const next = makeCounter();
next(); // 1
next(); // 2

makeCounter() has returned, but count lives on because the arrow function still uses it. Each call to makeCounter() starts a fresh count of its own.

Where would you like to go from here?

Ask on any code block

Every code example comes with a guide

Each code block on RealJS has an Ask Mentor AI button. Pick a question, and Mentor AI answers with that exact code in front of it: what it does, why it’s written that way, or a line-by-line walkthrough.

Ask it to quiz you on the snippet or turn it into a practice exercise, and a code example becomes something you can learn from.

Try it with Mentor AI

Mentor AI
“names.forEach((name, i) => {”
Walk me through this line by line.
Reading “Looping Over Arrays in JavaScript”

Line by line:

  1. names and ages are two arrays that belong together by position: "Ada" goes with 36, "Grace" with 45.
  2. names.forEach(...) calls the arrow function once for each name, passing the name and its index i.
  3. ages[i] uses that index to fetch the matching age from the other array.
  4. The template literal prints them: Ada is 36.

One thing to watch: nothing checks that the arrays are the same length. If ages had only one item, the second line would print Grace is undefined.

Want to keep going?

Practice on demand

Exercises made for you, whenever you want them

Just finished a tutorial? Ask for an exercise on exactly what you learned, pitched at your level.

Paste your solution and Mentor AI runs it, reviews it, and points out what to try next. Practice until the new skill feels like your own.

Try it with Mentor AI

Mentor AI
I just finished the array methods tutorial. Can you give me an exercise to practice?
Reviewing your learning activity

Here’s one at your level.

Clean up the guest list: Write normalizeGuests(names) that trims the whitespace from each name, capitalizes it, and drops empty entries, using array methods instead of a loop:

Language: JavaScript
normalizeGuests(["  ada ", "GRACE", "", "linus"]);
// ["Ada", "Grace", "Linus"]

Paste your solution here when you’re ready and I’ll review it.

function normalizeGuests(names) { return names .filter((name) => name) .map((name) => name.trim()) .map((name) => name[0].toUpperCase() + name.slice(1).toLowerCase()); }

Nice and readable! One case slips through: a name made of spaces only, like " ", passes your filter() because it isn’t empty until after you trim it. Then name[0] is undefined, and the last map() throws a TypeError.

Can you reorder the steps so the filter sees the trimmed name instead?

Facts you can check

Current answers about JavaScript itself

Which Node.js version added a feature, whether your runtime is still supported, what a package needs, where the official docs live: Mentor AI looks these up instead of guessing from memory.

Answers link to MDN and the docs they came from, so you can read the source and check for yourself.

Try it with Mentor AI

Mentor AI
Can I use findLast()? My work project still runs on Node.js 16.
Looking up “Node.js 16”
Looking up “findLast”

Not on Node.js 16, unfortunately. Array.prototype.findLast() is part of ES2023 and arrived in Node.js 18, so on 16 you get TypeError: numbers.findLast is not a function.

Two things worth knowing:

  • Node.js 16 reached end of life in September 2023, so it no longer gets security fixes. That’s a good argument for the upgrade, beyond findLast().
  • Until then, you can search a reversed copy: [...numbers].reverse().find(isEven) gives the same result without changing the original array.

Find the right resource

The right tutorial for what you want to learn

Tell Mentor AI what you want to learn or build. It searches the RealJS library and suggests a sensible order through the tutorials, video courses, and learning paths that fit your goal.

No more guessing where to start.

Try it with Mentor AI

Mentor AI
I want to start building web APIs. Where should I begin?
Searching for “rest api”

Great goal! Here’s an order that builds nicely:

  1. Working With REST APIs Using fetch() shows how APIs work from the client side, right in the browser.
  2. Building a REST API With Node.js and Express walks you through building your own API from scratch.
  3. Validating API Input With Zod is a video course on making your API robust, once the basics feel comfortable.

Want me to suggest a small project to build along the way?

Lost in a lesson

Pause the video and ask

Mentor AI knows which lesson you’re watching and how far in you are, so when something doesn’t land you can just ask. It picks up where the instructor left off and explains it another way, at your level, building on what you’ve already learned on RealJS.

It comes along from page to page, too: a question you ask in a lesson can carry on in the exercise after it.

Try it with Mentor AI

Mentor AI
Hang on, I'm a bit lost. Why does she return something inside every then()?
Reading “Chaining Promises With then()”
Reviewing your learning activity

This is the part that trips most people up, so good place to pause. Each then() hands whatever its callback returns to the next then() in the chain.

You’ve already met arrow functions, and that’s what keeps these short: with no curly braces, the value is returned for you.

Language: JavaScript
fetch("/api/user")
  .then((response) => response.json())
  .then((user) => {
    console.log(user.name);
  });

The first callback returns the promise from json(), so the second one receives the parsed user. If a callback has curly braces and you forget return, the next then() gets undefined instead.

Where to from here?

Built to help you learn

Hints before answers

Mentor AI coaches you toward solutions instead of handing them over, so what you learn sticks. When you want the full answer, just ask.

Grounded in RealJS

Answers draw on RealJS’s tutorials, courses, and JavaScript reference, with links so you can read more on your own.

Picks up where you left off

Mentor AI follows you from page to page, and your conversations are saved, so you can return to one anytime.

A note from our CEO, Dan Bader:

Hey there,

I’ve spent almost two decades helping people become better programmers. One thing has stayed frustratingly constant: the best way to learn is with a great mentor sitting next to you.

A great mentor doesn’t just answer your question. They notice where you’re stuck, ask the question that makes it “click,” and explain things in a way that fits how you think.

A great mentor knows what you already understand and what you’re working toward.

The thing is, almost nobody gets a great mentor. That kind of guidance has always been rare and expensive. For most learners, it simply wasn’t available.

That’s the problem we’ve set out to solve with RealJS Mentor AI.

Mentor AI is an AI learning companion that follows you across every page on RealJS. It knows your learning history and your goals, and it uses that knowledge to meet you where you are.

If a concept in a tutorial isn’t landing, Mentor can break it down differently, connect it to something you already know, or walk you through it step by step until it does.

And we deliberately built Mentor so it doesn’t just hand you the answer:

When you’re working through a coding exercise or a quiz, it engages you in a Socratic dialogue. It helps you spot your own sticking points and work through them, because that “zone of proximal development” is where real learning happens.

When you’re stuck on a coding exercise, Mentor won’t paste the solution. It asks what you’ve tried, points you toward the line that matters, and lets you make the connection yourself.

This is also what makes Mentor AI different from a general-purpose chatbot.

Mentor is grounded in the RealJS library: our textbook-quality tutorials, video courses, interactive quizzes, and coding exercises. It reads the same resources you’re reading.

It can check MDN and npm to cross-reference details and make sure what you’re getting is accurate and current. And it interfaces directly with our interactive learning tools, so the help you get is tied to what you’re actually doing, not a vague guess about it.

Why learn to code at all in the age of AI?

Here’s the thing:

AI can write good code. Increasingly, it writes a lot of it. But as engineers, we’re responsible for the outcomes.

We decide what gets built, we judge whether it’s right, and we own the results. You can’t do that well if you don’t understand what’s happening underneath.

Think about how we learned sorting algorithms in school. Almost nobody implements quicksort from scratch on the job. We learned them anyway, because the point was never the implementation. It was building the mental models that let you reason about performance, trade-offs, and correctness.

Those mental models are exactly what you need to direct AI coding agents, catch their mistakes, and contribute real value to a modern software team.

So the skill set hasn’t gone away. If anything, the bar for understanding has gone up. The nitty-gritty typing is increasingly handled for you. The thinking is NOT.

The future of coding education is personal

This technology finally lets us make learning adaptive to each person: paced to you, explained in the way that resonates with you, and focused on what you actually need next.

Honestly, it also makes learning a lot more fun. Getting unstuck quickly, with a patient guide who understands your context, changes how it feels to learn something hard.

That’s the kind of education I wish I’d had. I’m proud that we get to build it, and I’d love for you to try it.

Happy coding!

Dan Bader
CEO and Editor-in-Chief, RealJS

Questions and answers

Mentor AI is part of a RealJS membership. As a member, you’ll find the Mentor AI orb in the corner of every page. Click it to start a conversation.

It can see the page you’re on, any text you highlight and ask about, and your attempts on coding exercises. It also knows your learning goals, your level of experience, and what you’ve been working on at RealJS. It uses all of this to give you guidance that fits where you are in your learning journey.

Yes. The orb and the chat work on phones and tablets, and because your conversations are saved to your account, you can start one on your laptop and pick it up on your phone.

We’d love to hear how Mentor AI is working for you. Send us your thoughts, or rate individual answers right in the chat.

Learn JavaScript with a mentor at your side

Meet Mentor AI: this orb is your personal JavaScript mentor. Click it to create your account and say hi.

Mentor AI is part of a RealJS membership. Already a member? Sign in