AI development prompts
256 reusable prompts. Each states the context, the task, constraints, expected behaviour and how to test the answer. Use them with any AI assistant, then verify the result by running code.
Use AI to explain, review and suggest; then inspect the code, run it, run the tests and check security yourself. No AI service is connected to the academy.
Code prediction
Lesson 1 Quiz me on output
Context: I can use console.log with strings and arithmetic. Task: Give me five one-line console.log statements and ask me to predict each output. Constraints: Use only strings, numbers, + - * / and parentheses. Wait for my answers before revealing results. Expected behaviour: Each item has one exact output. Testing: After I answer, show the real output and explain any I got wrong.
Lesson 2 Sequence drill
Context: I know that statements run top to bottom. Task: Write a six-line program using let, reassignment and console.log, and ask me to predict the full output. Constraints: Only numbers, strings, let, const, + and *. Do not reveal the answer until I reply. Expected behaviour: The output has four lines. Testing: Show the correct output and trace each line after I answer.
Lesson 3 Precedence drill
Context: I know * and / come before + and -. Task: Give me six arithmetic expressions mixing + - * / % and parentheses and ask for their values. Constraints: Integers only, results under 200. Wait before revealing answers. Expected behaviour: Each expression has a single numeric answer. Testing: Explain the grouping for any I get wrong.
Lesson 4 Strings or numbers?
Context: I am learning to read console output. Task: Give me six console.log lines mixing strings, numbers and small lists, and ask me what each prints. Constraints: Wait for my answers before revealing. Expected behaviour: I can tell a string from a number in a list. Testing: Explain each answer in one sentence.
Lesson 6 Reassignment chain
Context: I can follow simple assignments. Task: Give me five short programs that reassign let variables and ask what they print. Constraints: Integers only, at most four lines each. Expected behaviour: Each has one exact answer. Testing: Reveal the answers only after I reply.
Lesson 7 String method drill
Context: I know length, trim, toUpperCase, includes and slice. Task: Ask me eight short questions about what each call returns. Constraints: Use product names as data; wait for my answers. Expected behaviour: Each question has one exact answer. Testing: Explain any I get wrong with the index positions.
Lesson 8 Math method quiz
Context: I know round, floor, ceil, max, min and abs. Task: Ask me eight questions, including negative numbers. Constraints: Wait for my answers before explaining. Expected behaviour: Each has one exact answer. Testing: Explain floor versus round for negatives.
Lesson 9 Truthiness drill
Context: I know the six falsy values. Task: Ask me ten Boolean(...) questions including tricky strings. Constraints: Wait for my answers. Expected behaviour: Each has one answer. Testing: Explain each one I miss.
Lesson 10 Coercion puzzles
Context: I know Number, parseInt and parseFloat. Task: Give me eight conversion expressions to evaluate. Constraints: Include empty strings and units like px. Wait for answers. Expected behaviour: Each has one answer. Testing: Explain any I miss.
Lesson 11 Comparison drill
Context: I know <, >, <=, >=, === and !==. Task: Ask me ten comparison questions with numbers and strings. Constraints: Wait for answers. Expected behaviour: Each has one answer. Testing: Explain string ordering for any I miss.
Lesson 12 Short-circuit puzzles
Context: I know short-circuit evaluation. Task: Give me six expressions with console.log calls on both sides and ask what prints. Constraints: Wait for answers. Expected behaviour: Each has an exact output. Testing: Explain the order of evaluation.
Lesson 13 Branch tracing
Context: I can read else if chains. Task: Give me five chains with an input and ask which branch runs. Constraints: Wait for answers. Expected behaviour: Each has one answer. Testing: Explain ordering mistakes.
Lesson 14 Fall-through puzzles
Context: I know break and default. Task: Give me five switch statements with missing breaks and ask what prints. Constraints: Wait for answers. Expected behaviour: Each has one exact output. Testing: Explain the flow for any I miss.
Lesson 16 Loop tracing drill
Context: I know the three parts of a for loop. Task: Show me six short loops and ask how many times each runs and what it prints. Constraints: Wait for my answers. Expected behaviour: Include counting down and steps of 2 or 5. Testing: Explain any I miss with a trace table.
Lesson 17 Loop condition drill
Context: I know while loops. Task: Give me six while and do...while loops and ask what each prints. Constraints: Include one infinite loop. Expected behaviour: Each has one answer. Testing: Explain the state change each time.
Lesson 18 Loop control drill
Context: I know break and continue. Task: Ask me to predict five loops that use them. Constraints: Wait for answers. Expected behaviour: Include one nested loop. Testing: Explain any I miss with a trace.
Lesson 19 Pattern drill
Context: I understand nested loops. Task: Show me five pattern programs and ask what each prints. Constraints: Wait for answers. Expected behaviour: Include triangles and grids. Testing: Explain the inner limit each time.
Lesson 20 Pattern tracing
Context: I know the four patterns. Task: Give me five short programs combining them and ask what each prints. Constraints: Wait for my answers. Expected behaviour: Include negative numbers. Testing: Explain with a trace table.
Lesson 21 Call order
Context: I know how to declare and call functions. Task: Give me five programs and ask the order of their output lines. Constraints: Wait for answers. Expected behaviour: Include hoisting. Testing: Explain any I miss.
Lesson 22 Argument drill
Context: I know parameters and defaults. Task: Give me six calls with missing, extra and null arguments and ask what is printed. Constraints: Wait for my answers. Expected behaviour: Each has one answer. Testing: Explain default rules for any I miss.
Lesson 23 Return drill
Context: I understand return. Task: Give me six programs with early returns and missing returns and ask what is printed. Constraints: Wait for answers. Expected behaviour: Each has one answer. Testing: Explain with the call stack.
Lesson 24 Arrow drill
Context: I know arrow functions. Task: Give me six arrows, some returning undefined by mistake, and ask what each returns. Constraints: Wait for answers. Expected behaviour: Include an object return. Testing: Explain any I miss.
Lesson 25 Composition drill
Context: I know how to combine functions. Task: Give me five nested function calls and ask for the result. Constraints: Wait for answers. Expected behaviour: Include one where order changes the result. Testing: Explain inside-out evaluation.
Lesson 26 arrays drill
Context: I have practised arrays. Task: Ask me eight questions about reading elements by index, including negative at() indexes. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 27 array mutation methods drill
Context: I have practised array mutation methods. Task: Give me eight short programs using these methods and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 28 searching and sorting arrays drill
Context: I have practised searching and sorting arrays. Task: Ask me eight questions about search results and sort orders, including the default text sort of numbers. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 29 iterating arrays drill
Context: I have practised iterating arrays. Task: Show me six loops and ask what each prints, including one for...in trap. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 30 collection-based applications drill
Context: I have practised collection-based applications. Task: Give me five sequences of collection operations and ask what the final state is. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 31 forEach and callbacks drill
Context: I have practised forEach and callbacks. Task: Give me six forEach snippets and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 32 map transformations drill
Context: I have practised map transformations. Task: Give me six map calls and ask for the resulting arrays, including one parseInt trap. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 33 filter, some and every drill
Context: I have practised filter, some and every. Task: Give me six filter, some and every calls and ask for the results, including empty arrays. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 34 reduce drill
Context: I have practised reduce. Task: Give me six reduce calls and ask for their results, including different initial values. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 35 array method pipelines drill
Context: I have practised array method pipelines. Task: Show me five pipelines and ask what each returns, with one where step order changes the result. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 36 JavaScript objects drill
Context: I have practised JavaScript objects. Task: Give me six snippets that read, add, change and delete properties and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 37 dynamic keys and methods drill
Context: I have practised dynamic keys and methods. Task: Give me six snippets with dynamic keys and this and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 38 nested objects and arrays drill
Context: I have practised nested objects and arrays. Task: Give me six nested data structures and ask me to write the path to a value. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 39 references and copying drill
Context: I have practised references and copying. Task: Give me six snippets with assignments and copies and ask which values change. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 40 data modelling drill
Context: I have practised data modelling. Task: Show me five data models and ask me to spot duplicated or contradictory data. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 41 destructuring drill
Context: I have practised destructuring. Task: Give me six destructuring snippets, including defaults with null and undefined, and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 42 spread and rest syntax drill
Context: I have practised spread and rest syntax. Task: Give me six snippets mixing spread, rest and property order and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 43 optional chaining drill
Context: I have practised optional chaining. Task: Give me six snippets with ?. in different positions and ask which throw and which print undefined. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 44 nullish coalescing and default values drill
Context: I have practised nullish coalescing and default values. Task: Give me six snippets mixing ||, ??, ??= and defaults and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 45 Sets and Maps drill
Context: I have practised Sets and Maps. Task: Give me six snippets with Set and Map, including object keys and NaN, and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 46 scope drill
Context: I have practised scope. Task: Give me six snippets with nested scopes and shadowed names and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 47 lexical scope and the scope chain drill
Context: I have practised lexical scope and the scope chain. Task: Give me six snippets where a function is defined in one place and called in another, and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 48 closures drill
Context: I have practised closures. Task: Give me six closure snippets, including the var loop trap, and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 49 hoisting and the temporal dead zone drill
Context: I have practised hoisting and the temporal dead zone. Task: Give me six snippets that use names before their declarations and ask what each prints or throws. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Lesson 50 execution contexts and the call stack drill
Context: I have practised execution contexts and the call stack. Task: Give me six snippets with nested calls, recursion and this, and ask what each prints. Constraints: Wait for my answer before revealing each result. Expected behaviour: Each question has exactly one correct output. Testing: Explain any I miss with a step-by-step trace.
Code review
Lesson 4 Review my debug output
Context: I wrote a 15-line debug log for a calculation. Task: Review whether the labels and grouping make it easy to read. Constraints: Suggest improvements without changing the calculation. Expected behaviour: The output reads as a clear trace. Testing: Show the improved output, not only the code.
Lesson 5 Is this AI fix safe?
Context: An AI suggested a fix for my ReferenceError. Task: Help me check whether the suggestion fixes the cause or only hides the symptom. Constraints: Ask to see the original code, the error and the suggested change. Expected behaviour: I can explain why the fix is correct, or why it is not. Testing: Suggest a test that would fail before the fix and pass after it.
Lesson 6 Review my variable names
Context: I wrote a 10-line parking cost program. Task: Suggest clearer names for my variables and explain why each is better. Constraints: Do not change the logic. Keep camelCase. Expected behaviour: Every name says what its value means. Testing: List old name → new name so I can rename and rerun.
Lesson 7 Message builder review
Context: I wrote a function-free script that builds five customer messages. Task: Review it for missing spaces, inconsistent quotes and repeated code. Constraints: Keep it beginner level, no functions yet. Expected behaviour: The messages are consistent and readable. Testing: Point to line numbers.
Lesson 8 Money handling review
Context: I wrote a script that totals five decimal prices with tax. Task: Review where rounding happens and whether it is consistent. Constraints: Do not rewrite; list problems with line numbers. Expected behaviour: Rounding happens once, at a clear point. Testing: Suggest a test case that would expose any problem.
Lesson 9 Boolean naming review
Context: I have six boolean variables in my script. Task: Review their names and suggest yes/no question names. Constraints: Keep the logic; rename only. Expected behaviour: Every boolean reads as a question. Testing: List old → new names.
Lesson 10 Conversion review
Context: My script reads five form values and calculates a total. Task: Review where conversions happen and suggest converting once at input. Constraints: No rewrites; list issues. Expected behaviour: Each value is converted exactly once. Testing: Point out any missing NaN check.
Lesson 11 Equality review
Context: My script uses several == comparisons. Task: Review which ones could misbehave and suggest replacements. Constraints: Explain each risk briefly. Expected behaviour: No == remains unless justified. Testing: List the lines to change.
Lesson 12 Condition readability
Context: I have a long condition with five parts. Task: Suggest how to split it into named booleans. Constraints: Keep behaviour identical. Expected behaviour: Each part has a clear name. Testing: Provide test cases proving it still behaves the same.
Lesson 13 Nested if review
Context: My validation code has ifs nested four levels deep. Task: Show me how guard clauses could flatten it. Constraints: Keep behaviour identical. Expected behaviour: No more than two levels of nesting. Testing: Give tests that show the behaviour is unchanged.
Lesson 14 Ternary readability
Context: My code has a ternary nested three levels deep. Task: Rewrite suggestions that are easier to read. Constraints: Same behaviour. Expected behaviour: No nested ternaries. Testing: List inputs and outputs that prove equivalence.
Lesson 15 Magic numbers
Context: My decision code has numbers like 30, 3 and 15 in several places. Task: Show me which to turn into named constants. Constraints: Keep behaviour identical. Expected behaviour: No unexplained numbers remain. Testing: List the constants and their meaning.
Lesson 16 Repeated lines
Context: My program repeats console.log ten times with small changes. Task: Show me how to replace them with a loop. Constraints: Keep output identical. Expected behaviour: Only one console.log remains. Testing: Explain the counter values.
Lesson 17 Loop safety
Context: My loop retries until a request succeeds. Task: Review it for infinite-loop risks. Constraints: Suggest guards and clear names. Expected behaviour: The loop always terminates. Testing: List the changes.
Lesson 18 Control flow
Context: My loop has four break statements. Task: Suggest a clearer structure. Constraints: Keep behaviour identical. Expected behaviour: At most one exit point. Testing: Explain the trade-offs.
Lesson 19 Slow nested loops
Context: My code compares two lists with nested loops. Task: Show me a faster approach and explain why. Constraints: Keep the result identical. Expected behaviour: Explain the number of operations before and after. Testing: Compare readability.
Lesson 20 Planning
Context: Here is my plan and my loop for a weekly report. Task: Check that my plan and code match and that edge cases are handled. Constraints: Do not rewrite everything. Expected behaviour: Every edge case has a defined result. Testing: List missing tests.
Lesson 21 Function names
Context: Here are my function names. Task: Review them and suggest clearer verb-based names. Constraints: Explain each suggestion. Expected behaviour: Every name says what the function does. Testing: Give me a naming checklist.
Lesson 22 Long parameter lists
Context: My function has five parameters. Task: Show me how to switch to an options object. Constraints: Keep behaviour identical. Expected behaviour: Calls are self-describing. Testing: Show before and after calls.
Lesson 23 Side effects
Context: My calculation functions print and update globals. Task: Show me how to make them pure. Constraints: Keep behaviour identical. Expected behaviour: Printing happens in one place. Testing: Explain the benefits.
Lesson 24 Arrow style
Context: My code mixes arrows and declarations randomly. Task: Suggest a consistent style and explain it. Constraints: Keep behaviour identical. Expected behaviour: Each choice has a reason. Testing: Give me a short style guide.
Lesson 25 Function design
Context: Here is my mini application. Task: Review function names, responsibilities and where printing happens. Constraints: Do not rewrite everything. Expected behaviour: Each function has one job. Testing: List the top three improvements.
Lesson 26 arrays review
Context: Here is my code that uses arrays. Task: Review how I read and update elements and point out any off-by-one risks. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 27 array mutation methods review
Context: Here is my code that uses array mutation methods. Task: Review where my code mutates shared arrays and suggest non-mutating alternatives. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 28 searching and sorting arrays review
Context: Here is my code that uses searching and sorting arrays. Task: Review my sorting code for mutation of shared data and incorrect compare functions. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 29 iterating arrays review
Context: Here is my code that uses iterating arrays. Task: Review my loops and suggest the clearest loop type for each. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 30 collection-based applications review
Context: Here is my code that uses collection-based applications. Task: Review my collection functions for id handling, not-found cases and separation of display from data. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 31 forEach and callbacks review
Context: Here is my code that uses forEach and callbacks. Task: Review my forEach calls and tell me which would be clearer as map, filter or for...of. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 32 map transformations review
Context: Here is my code that uses map transformations. Task: Review my map callbacks for missing returns and accidental mutation. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 33 filter, some and every review
Context: Here is my code that uses filter, some and every. Task: Review my filters and suggest named predicates where conditions are hard to read. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 34 reduce review
Context: Here is my code that uses reduce. Task: Review my reduce calls for missing initial values, missing returns and readability. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 35 array method pipelines review
Context: Here is my code that uses array method pipelines. Task: Review my pipelines for step order, mutation and readability, and suggest named steps. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 36 JavaScript objects review
Context: Here is my code that uses JavaScript objects. Task: Review how my code creates objects and suggest a consistent shape. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 37 dynamic keys and methods review
Context: Here is my code that uses dynamic keys and methods. Task: Review my object code for dot-vs-bracket mistakes and for methods written as arrow functions. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 38 nested objects and arrays review
Context: Here is my code that uses nested objects and arrays. Task: Review how my code reads deeply nested data and suggest accessor functions. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 39 references and copying review
Context: Here is my code that uses references and copying. Task: Review my code for accidental shared references and suggest copies where needed. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 40 data modelling review
Context: Here is my code that uses data modelling. Task: Review my data model for duplicated data, unclear names and values that should be derived. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 41 destructuring review
Context: Here is my code that uses destructuring. Task: Review my functions and suggest where destructured parameters would make them clearer. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 42 spread and rest syntax review
Context: Here is my code that uses spread and rest syntax. Task: Review my code for mutations that spread could replace, and for shallow-copy mistakes. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 43 optional chaining review
Context: Here is my code that uses optional chaining. Task: Review my code for places where ?. hides bugs and places where it is genuinely needed. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 44 nullish coalescing and default values review
Context: Here is my code that uses nullish coalescing and default values. Task: Review my code for || fallbacks that should be ?? and for defaults that miss null. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 45 Sets and Maps review
Context: Here is my code that uses Sets and Maps. Task: Review my code for arrays and objects that would be clearer or faster as a Set or Map. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 46 scope review
Context: Here is my code that uses scope. Task: Review my code for variables declared in a wider scope than they need. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 47 lexical scope and the scope chain review
Context: Here is my code that uses lexical scope and the scope chain. Task: Review my code for functions that depend on hidden outer variables instead of parameters. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 48 closures review
Context: Here is my code that uses closures. Task: Review my code for global state that could be a closure and for closures that hold large data unnecessarily. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 49 hoisting and the temporal dead zone review
Context: Here is my code that uses hoisting and the temporal dead zone. Task: Review my file for code that depends on hoisting and suggest a clearer order. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Lesson 50 execution contexts and the call stack review
Context: Here is my code that uses execution contexts and the call stack. Task: Review my recursive and method-heavy code for stack and this problems. Constraints: Explain each suggestion briefly and keep behaviour identical. Expected behaviour: The code is clearer and has no hidden mutation or edge-case bug. Testing: List the changes in order of importance.
Concept explanation
Lesson 1 Explain hosts with an analogy
Context: I am a complete beginner in Lesson 1 of a JavaScript course. Task: Explain the difference between the JavaScript language and the browser or Node.js host, using one everyday analogy. Constraints: Under 150 words. No code longer than two lines. Do not introduce frameworks. Expected behaviour: I can say which of console.log, document and fs belongs to which environment. Testing: Finish with three quick questions I can answer to check my understanding, with answers hidden at the end.
Lesson 2 Strings versus numbers
Context: I am learning that + behaves differently for strings and numbers. Task: Explain why "2" + 3 gives "23" while 2 + 3 gives 5. Constraints: Use at most four short code lines. Avoid the words coercion and primitive unless you define them. Expected behaviour: I can predict the result of + for any mix of strings and numbers. Testing: Give me four mixed examples to predict, with answers at the end.
Lesson 3 Statements and expressions
Context: I am learning the difference between statements and expressions. Task: Explain it with five labelled examples from a shopping-cart program. Constraints: Use only let, const, numbers, strings and arithmetic. Expected behaviour: I can label any simple line as statement, expression or both. Testing: Give me five unlabeled lines to classify, with answers at the end.
Lesson 4 Log levels in real teams
Context: I know console.log, warn and error. Task: Explain how professional teams use log levels in production applications. Constraints: Under 200 words, no specific vendor products. Expected behaviour: I can decide which level fits a message. Testing: Give me five messages to classify.
Lesson 5 Syntax versus runtime errors
Context: I am learning about JavaScript errors. Task: Explain the difference between syntax errors and runtime errors with two tiny examples of each. Constraints: Examples must be three lines or fewer. Expected behaviour: I can predict which lines run before each error. Testing: Ask me what prints for each example before explaining.
Lesson 6 let versus const
Context: I am learning let and const in JavaScript. Task: Explain when to use each with three examples from a shopping cart. Constraints: Beginner level, no var, no objects. Expected behaviour: I can choose the right keyword for any simple variable. Testing: End with four declarations for me to classify, answers hidden at the bottom.
Lesson 7 Template literals
Context: I know how to join strings with +. Task: Explain template literals by converting four + expressions into template literals. Constraints: Beginner level; include one multi-line example. Expected behaviour: I can rewrite any + chain as a template literal. Testing: Give me two + chains to convert, with answers hidden.
Lesson 8 Floating point for beginners
Context: I saw 0.1 + 0.2 = 0.30000000000000004. Task: Explain why with a simple analogy (like writing 1/3 in decimal). Constraints: No binary maths beyond one example. Expected behaviour: I can explain why money uses cents. Testing: Give me two calculations to try in the playground that show the effect.
Lesson 9 null versus undefined
Context: I mix up null and undefined. Task: Explain the difference with a form-filling analogy and three code examples. Constraints: Beginner level. Expected behaviour: I can say which one a program will produce in common cases. Testing: Give me four snippets to classify.
Lesson 10 Explicit versus implicit conversion
Context: I am learning type conversion. Task: Explain explicit and implicit conversion with six short examples. Constraints: Beginner level, no objects. Expected behaviour: I can predict + and - with mixed types. Testing: End with four snippets to predict.
Lesson 11 === versus ==
Context: I am learning equality in JavaScript. Task: Explain === and == with six examples, three of them surprising. Constraints: Beginner level. Expected behaviour: I can explain why === is preferred. Testing: Give me four comparisons to predict.
Lesson 12 Logical operators with stories
Context: I am learning &&, || and !. Task: Explain each with a real-world rule from shopping or travel. Constraints: Beginner level; include a truth table. Expected behaviour: I can translate a sentence into a logical expression. Testing: Give me three sentences to translate.
Lesson 13 if / else if / else
Context: I am learning conditionals. Task: Explain if, else if and else using a parcel tracking example. Constraints: Beginner level. Expected behaviour: I can predict which branch runs. Testing: Give me three inputs to trace.
Lesson 14 switch versus if
Context: I know if/else if and am learning switch. Task: Explain when switch reads better, with two side-by-side examples. Constraints: Beginner level. Expected behaviour: I can choose between switch and if. Testing: Give me two scenarios to decide.
Lesson 15 Boundary testing
Context: I am learning to test decision programs. Task: Explain boundary values and equivalence classes with a parking-fee example. Constraints: Beginner level. Expected behaviour: I can choose test inputs for any rule. Testing: Give me a rule and ask me for test inputs.
Lesson 16 for loops
Context: I am learning for loops. Task: Explain start, condition and update with a step-by-step trace of a loop from 1 to 3. Constraints: Beginner level. Expected behaviour: I can trace a loop on paper. Testing: Give me three loops to trace.
Lesson 17 while and do...while
Context: I know for loops. Task: Explain when to use while and do...while instead, with three real situations each. Constraints: Beginner level. Expected behaviour: I can choose the right loop. Testing: Ask me to pick a loop for five situations.
Lesson 18 break and continue
Context: I am learning loop control. Task: Explain break and continue with a search and a filter example. Constraints: Beginner level. Expected behaviour: I can say which to use. Testing: Give me three situations to choose for.
Lesson 19 Nested loops
Context: I know single loops. Task: Explain nested loops with a seat map and a trace table of both counters. Constraints: Beginner level. Expected behaviour: I can predict how many times the inner body runs. Testing: Ask me three counting questions.
Lesson 20 Loop patterns
Context: I can write loops. Task: Explain the accumulator, counter, maximum and search patterns with one example each. Constraints: Beginner level. Expected behaviour: I can name the pattern a problem needs. Testing: Give me five problems to classify.
Lesson 21 Functions
Context: I am new to functions. Task: Explain defining versus calling with a receipt example. Constraints: Beginner level. Expected behaviour: I can explain why functions reduce repetition. Testing: Give me three programs to refactor.
Lesson 22 Parameters and arguments
Context: I know how to call functions. Task: Explain parameters, arguments and defaults with a shipping label example. Constraints: Beginner level. Expected behaviour: I can tell parameters from arguments. Testing: Ask me five quick questions.
Lesson 23 Return values
Context: I know parameters. Task: Explain return versus console.log with a checkout example. Constraints: Beginner level. Expected behaviour: I can say when to return. Testing: Give me three functions to convert.
Lesson 24 Arrow functions
Context: I know function expressions. Task: Explain arrow syntax, concise and block bodies with five examples. Constraints: Beginner level. Expected behaviour: I can convert a function to an arrow. Testing: Give me four to convert.
Lesson 25 Decomposition
Context: I can write functions. Task: Show me how to split a tip calculator into five small functions and explain each. Constraints: Beginner level. Expected behaviour: I can name the functions myself next time. Testing: Give me another app to decompose.
Lesson 26 arrays
Context: I am learning arrays in JavaScript. Task: Explain arrays, indexes and length with a playlist example and a drawing of the index positions. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 27 array mutation methods
Context: I am learning array mutation methods in JavaScript. Task: Explain push, pop, shift, unshift, splice and slice with a cart example, marking which ones change the array. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 28 searching and sorting arrays
Context: I am learning searching and sorting arrays in JavaScript. Task: Explain includes, indexOf, find, findIndex and sort with compare functions, using a product list. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 29 iterating arrays
Context: I am learning iterating arrays in JavaScript. Task: Compare for, for...of, entries(), forEach and for...in with one shared example and say when each is the right choice. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 30 collection-based applications
Context: I am learning collection-based applications in JavaScript. Task: Show me how to design a small to-do application around one array of objects with add, complete, remove and summary functions. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 31 forEach and callbacks
Context: I am learning forEach and callbacks in JavaScript. Task: Explain callbacks and forEach with a reminder-sending example, including what forEach returns. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 32 map transformations
Context: I am learning map transformations in JavaScript. Task: Explain map with prices and objects, including why the callback must return a value. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 33 filter, some and every
Context: I am learning filter, some and every in JavaScript. Task: Explain filter, predicates, some and every with a product search example. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 34 reduce
Context: I am learning reduce in JavaScript. Task: Explain reduce with a step-by-step table of the accumulator for a sum, a maximum and a count. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 35 array method pipelines
Context: I am learning array method pipelines in JavaScript. Task: Explain method chaining with filter, sort, slice, map and reduce using a sales dashboard example. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 36 JavaScript objects
Context: I am learning JavaScript objects in JavaScript. Task: Explain objects, keys and dot notation with a customer record example. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 37 dynamic keys and methods
Context: I am learning dynamic keys and methods in JavaScript. Task: Explain bracket notation, computed keys, Object.entries and methods with this, using a settings object. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 38 nested objects and arrays
Context: I am learning nested objects and arrays in JavaScript. Task: Explain how to read paths through nested objects and arrays with an order example. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 39 references and copying
Context: I am learning references and copying in JavaScript. Task: Explain value vs reference, shallow vs deep copies and === on objects, with diagrams in text. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 40 data modelling
Context: I am learning data modelling in JavaScript. Task: Help me model a small library or booking system as entities, properties and id links, explaining each choice. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 41 destructuring
Context: I am learning destructuring in JavaScript. Task: Explain object and array destructuring, renaming and defaults with a user settings example. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 42 spread and rest syntax
Context: I am learning spread and rest syntax in JavaScript. Task: Explain the difference between spread and rest with shopping cart examples. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 43 optional chaining
Context: I am learning optional chaining in JavaScript. Task: Explain optional chaining with a customer address example, including short-circuiting. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 44 nullish coalescing and default values
Context: I am learning nullish coalescing and default values in JavaScript. Task: Explain || versus ?? and default parameters using a settings example with zeros and empty strings. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 45 Sets and Maps
Context: I am learning Sets and Maps in JavaScript. Task: Explain Set and Map with examples of unique visitors and word counts, and when to choose them over arrays and objects. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 46 scope
Context: I am learning scope in JavaScript. Task: Explain global, function and block scope with a shopping app example, including shadowing. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 47 lexical scope and the scope chain
Context: I am learning lexical scope and the scope chain in JavaScript. Task: Explain lexical scope and the scope chain with nested functions, and how the engine looks up a name. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 48 closures
Context: I am learning closures in JavaScript. Task: Explain closures with a counter and a discount factory, and why each counter has its own state. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 49 hoisting and the temporal dead zone
Context: I am learning hoisting and the temporal dead zone in JavaScript. Task: Explain hoisting for function declarations, var, let and const, and the temporal dead zone, with short examples. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Lesson 50 execution contexts and the call stack
Context: I am learning execution contexts and the call stack in JavaScript. Task: Explain execution contexts, the call stack and stack traces with a three-function example, and how this is set. Constraints: Beginner-friendly language, short runnable examples, no libraries. Expected behaviour: I can explain the idea in my own words and predict small programs. Testing: Finish with three quick questions for me to answer.
Debugging
Lesson 1 Help me read a syntax error
Context: My code shows `SyntaxError: Unterminated string constant`. Task: Explain what the message means and how to find the problem without rewriting my code for me. Constraints: Ask me to paste the line number reported. Give hints, not the corrected line, unless I ask twice. Expected behaviour: I can find and fix the missing quote myself. Testing: Ask me to rerun the code and tell you the new output.
Lesson 3 Wrong average
Context: My average of three scores prints a number that is far too large. Task: Help me find the problem by asking questions about my expression. Constraints: Do not give me the corrected line until I have tried twice. Expected behaviour: I find the missing parentheses myself. Testing: Ask me to print the parts of the expression separately.
Lesson 4 Plan my logging
Context: My shopping-cart total is wrong and I do not know which step fails. Task: Suggest where to place labelled console.log lines to find the first wrong value. Constraints: Do not fix the code; suggest at most five log lines with labels. Expected behaviour: After running, I can point to the first incorrect value. Testing: Ask me to paste the output and help me interpret it.
Lesson 5 Coach me through an error
Context: My JavaScript shows an error I do not understand. Task: Ask me for the error name, message and line, then help me investigate without giving me the fix immediately. Constraints: Use the loop: reproduce, locate, inspect, change one thing, verify. One question per message. Expected behaviour: I fix the bug myself and can explain the cause. Testing: At the end, ask me to describe the root cause in one sentence.
Lesson 6 Assignment to constant
Context: My program stops with TypeError: Assignment to constant variable. Task: Help me find which line causes it by asking questions. Constraints: Do not rewrite the program. Expected behaviour: I can explain why the error happens and fix it myself. Testing: Ask me to run it again after each change.
Lesson 7 Text joined wrong
Context: My total prints as "Total: 105" instead of "Total: 15". Task: Help me understand why + joined the numbers. Constraints: Ask questions; do not give the fix straight away. Expected behaviour: I can explain left-to-right evaluation of + with strings. Testing: Suggest a console.log that shows the type of each part.
Lesson 8 Wrong rounding
Context: My bill split gives 33.33 each, so the total is 99.99 instead of 100. Task: Help me design a rounding rule that never undercharges. Constraints: Hints only; I write the code. Expected behaviour: Shares add up to at least the bill. Testing: Suggest three bills and party sizes to test.
Lesson 9 Default replaced my zero
Context: A setting of 0 keeps turning into the default value. Task: Help me find the operator that causes it. Constraints: Questions first, then a hint. Expected behaviour: I can explain || versus ??. Testing: Suggest a test with 0, "" and null.
Lesson 10 Text instead of numbers
Context: My form total prints 2050 instead of 70. Task: Help me trace which values are strings. Constraints: Ask me to log typeof for each value. Expected behaviour: I find and convert the strings myself. Testing: Suggest one test for empty input.
Lesson 11 Comparison always false
Context: My check of a typed code against a saved code is always false. Task: Help me find out why with questions about types and spaces. Constraints: No direct answer at first. Expected behaviour: I fix it myself. Testing: Suggest logs that reveal the problem.
Lesson 12 Rule too generous
Context: My discount rule gives discounts on weekends too. Task: Help me find the grouping problem. Constraints: Ask me to print each part of the condition. Expected behaviour: I fix it myself. Testing: Suggest all combinations to test.
Lesson 13 Wrong branch
Context: My grading program gives everyone the lowest grade. Task: Help me find the ordering or comparison problem. Constraints: Questions first. Expected behaviour: I fix the chain myself. Testing: Suggest boundary values to test (59, 60, 89, 90).
Lesson 14 Extra messages
Context: My switch prints two messages instead of one. Task: Help me find why. Constraints: Questions first. Expected behaviour: I fix it myself. Testing: Ask me to add a log at each case.
Lesson 15 Off by one
Context: My eligibility check fails for exactly the minimum age. Task: Help me find the comparison error. Constraints: Questions only. Expected behaviour: I fix it myself. Testing: Suggest the three boundary tests.
Lesson 16 Undefined at the end
Context: My loop prints undefined after the last item. Task: Help me find the boundary mistake with questions. Constraints: No direct answer at first. Expected behaviour: I fix it myself. Testing: Suggest a console.log that reveals the index.
Lesson 17 Frozen program
Context: My while loop never ends. Task: Ask me questions that lead me to the variable that never changes. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest a loop guard.
Lesson 18 Wrong match reported
Context: My search loop reports the last match instead of the first. Task: Help me see why with questions. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest a log that shows each check.
Lesson 19 Pattern looks wrong
Context: My triangle prints as a rectangle. Task: Help me find why with questions about the inner limit. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest logging both counters.
Lesson 20 Wrong maximum
Context: My maximum is 0 when all values are negative. Task: Help me find the starting value problem with questions. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest edge-case tests.
Lesson 21 Function does nothing
Context: My function prints nothing. Task: Ask questions that lead me to the problem. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: List the three most common causes.
Lesson 22 Wrong values
Context: My function shows the price where the name should be. Task: Help me find the argument-order bug with questions. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest an options-object version.
Lesson 23 NaN totals
Context: My total is NaN when I add two function results. Task: Help me find why with questions. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: Suggest a quick check of the return value.
Lesson 24 Undefined from an arrow
Context: My arrow function returns undefined. Task: Help me find why with questions. Constraints: No direct answer. Expected behaviour: I fix it myself. Testing: List the two common causes.
Lesson 25 Pipeline bug
Context: My composed functions return NaN. Task: Help me test each step to find where it breaks. Constraints: No direct answer. Expected behaviour: I find the step myself. Testing: Suggest a test for each helper.
Lesson 26 arrays bug
Context: My program prints undefined when I read the last element of my array. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 27 array mutation methods bug
Context: My splice call removes more items than I wanted. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 28 searching and sorting arrays bug
Context: My numbers sort in a strange order like 100, 25, 5. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 29 iterating arrays bug
Context: My loop adds up to a strange string like 0012 instead of a number. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 30 collection-based applications bug
Context: Removing an item from my list sometimes removes the wrong one. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 31 forEach and callbacks bug
Context: My forEach throws TypeError: undefined is not a function. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 32 map transformations bug
Context: My map returns an array full of undefined. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 33 filter, some and every bug
Context: My filter keeps every item and also changes my data. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 34 reduce bug
Context: My reduce result is undefined or NaN. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 35 array method pipelines bug
Context: My pipeline returns the wrong items or changes my original array. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 36 JavaScript objects bug
Context: My code prints undefined for a property I am sure I set. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 37 dynamic keys and methods bug
Context: My object gets a property literally called field instead of the field's name. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 38 nested objects and arrays bug
Context: My code throws Cannot read properties of undefined on a long path. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 39 references and copying bug
Context: Editing my copy also changes the original object. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 40 data modelling bug
Context: My stored totals and statuses keep going out of date. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 41 destructuring bug
Context: My destructured variable is undefined even though the object has the data. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 42 spread and rest syntax bug
Context: My copy made with spread still changes the original. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 43 optional chaining bug
Context: I added ?. but my code still throws TypeError: Cannot read properties of undefined. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 44 nullish coalescing and default values bug
Context: My setting of 0 keeps being replaced by the default value. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 45 Sets and Maps bug
Context: My Map lookups return undefined even though I added the data. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 46 scope bug
Context: My variable is not defined outside a loop, or has a value I did not expect. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 47 lexical scope and the scope chain bug
Context: My function cannot see a variable that exists where I call it. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 48 closures bug
Context: My callbacks all use the last value from a loop. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 49 hoisting and the temporal dead zone bug
Context: I get ReferenceError: Cannot access before initialization after moving code. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Lesson 50 execution contexts and the call stack bug
Context: My recursive function throws Maximum call stack size exceeded. Task: Help me find the cause with questions instead of giving me the fix. Constraints: Do not rewrite my program. Expected behaviour: I locate and fix the bug myself. Testing: Suggest the console.log lines that would reveal the problem.
Documentation
Lesson 3 Review my comments
Context: I added comments to a 10-line pay calculator. Task: Tell me which comments explain why and which only repeat what the code says. Constraints: Do not change the code. Suggest at most three improved comments. Expected behaviour: My comments add information the code does not show. Testing: Quote each comment you discuss so I can find it.
Exercise generation
Lesson 1 More practice like Exercise C
Context: I finished an exercise that prints a three-line café receipt with a calculated total. Task: Create two similar exercises with different items and prices. Constraints: Only console.log, strings, numbers and +. Provide expected output for each. Expected behaviour: Each exercise has exactly one correct output. Testing: Include the expected output so I can compare my result.
Lesson 3 Expression puzzles
Context: I finished the weekly pay exercise. Task: Create two practical calculation exercises (for example a recipe scaled for more people). Constraints: Provide constants, expected output and one rule that needs parentheses. Expected behaviour: Each exercise has exact expected output. Testing: Include the expected output and a test I can run by comparing it.
Lesson 5 Error-reading practice
Context: I can read ReferenceError, TypeError and SyntaxError messages. Task: Create four tiny broken programs, each with a different error, for me to fix. Constraints: Each under five lines; tell me the expected output after fixing. Expected behaviour: Each program has exactly one bug. Testing: List the expected output so I can verify my fixes.
Lesson 6 Variable drills
Context: I finished the parking meter exercise. Task: Create two more small calculation exercises that need both let and const. Constraints: Give exact expected output for each. Expected behaviour: Each exercise has one value that changes. Testing: Include the expected output to compare with mine.
Lesson 7 Formatting challenges
Context: I finished the shipping label exercise. Task: Create two exercises that format receipts or labels with template literals and string methods. Constraints: Exact expected output, fictional data. Expected behaviour: Each needs at least two string methods. Testing: Include the expected output.
Lesson 8 Number exercises
Context: I completed the converter exercise. Task: Create two exercises using Math methods and toFixed with real-world contexts. Constraints: Exact expected output, no functions yet. Expected behaviour: Each uses at least two Math methods. Testing: Include the expected output.
Lesson 9 Boolean flags
Context: I finished the checkout flags exercise. Task: Create two exercises that build well-named booleans from comparisons. Constraints: Fictional shop or library data, exact expected output. Expected behaviour: Each needs at least three flags. Testing: Include expected output.
Lesson 10 Input validation drills
Context: I finished the age validation exercise. Task: Create two validation exercises for text inputs (price, quantity). Constraints: Exact expected output for each input. Expected behaviour: Each handles empty, invalid and valid input. Testing: Include expected output.
Lesson 11 Business rules
Context: I finished the price rules exercise. Task: Create two exercises that turn business rules into comparisons. Constraints: Fictional data, exact output. Expected behaviour: Each has three or more rules. Testing: Include expected output.
Lesson 12 Rules to code
Context: I finished the library rules exercise. Task: Create two exercises that turn policies into logical expressions. Constraints: Exact expected output for given inputs. Expected behaviour: Each uses &&, || and !. Testing: Include expected output.
Lesson 13 Pricing tables
Context: I finished the cinema pricing exercise. Task: Create two exercises from pricing tables. Constraints: Exact expected output for given inputs. Expected behaviour: Each has at least three bands. Testing: Include expected outputs for three inputs.
Lesson 14 Menu choices
Context: I finished the order status exercise. Task: Create two switch exercises (calculator operator, keyboard shortcut). Constraints: Exact expected output. Expected behaviour: Each has a default. Testing: Include expected output for three inputs.
Lesson 15 Decision projects
Context: I finished the delivery estimator. Task: Create two small decision programs with requirements lists. Constraints: Exact expected output for three inputs each. Expected behaviour: Each has a validation rule. Testing: Include expected outputs.
Lesson 16 Loop practice
Context: I finished the order total exercise. Task: Create three loop exercises with shopping data. Constraints: Fictional data, exact output. Expected behaviour: One counts down, one steps by 5, one totals an array. Testing: Include solutions in a hidden section.
Lesson 17 Unknown repetitions
Context: I finished the doubling followers exercise. Task: Create three exercises where the number of repetitions must be calculated. Constraints: Fictional data, exact output. Expected behaviour: Use money, time and growth. Testing: Include expected output.
Lesson 18 Budget loops
Context: I finished the budget cart exercise. Task: Create two exercises that need both continue and break. Constraints: Fictional data, exact output. Expected behaviour: Real shopping or booking contexts. Testing: Include expected output.
Lesson 19 Grid problems
Context: I finished the multiplication grid. Task: Create three grid exercises with arrays of arrays. Constraints: Fictional data, exact output. Expected behaviour: Include row and column totals. Testing: Include expected output.
Lesson 20 Data problems
Context: I finished the sales summary. Task: Create three problems that need two or more loop patterns. Constraints: Fictional data, exact output. Expected behaviour: Include an empty-list edge case. Testing: Include expected output.
Lesson 21 Refactoring practice
Context: I finished the receipt header exercise. Task: Create two programs with repeated code for me to turn into functions. Constraints: Exact output must stay the same. Expected behaviour: Each has at least two repeated blocks. Testing: Include the expected output.
Lesson 22 Function inputs
Context: I finished the price with tax exercise. Task: Create two functions to write with three parameters and one default. Constraints: Fictional data, exact output. Expected behaviour: Include a call that uses the default. Testing: Include expected output.
Lesson 23 Pure functions
Context: I finished the invoice summary. Task: Create three pure-function exercises with exact tests. Constraints: Fictional data. Expected behaviour: Each returns a value or object. Testing: Include expected outputs.
Lesson 24 Callbacks
Context: I finished the label maker. Task: Create three exercises using arrow callbacks with map and filter. Constraints: Fictional data, exact output. Expected behaviour: Each needs a named arrow function. Testing: Include expected outputs.
Lesson 25 Mini applications
Context: I finished the mini tip calculator. Task: Create one more mini application specification that needs parse, validate, calculate and format functions. Constraints: Fictional data, exact output. Expected behaviour: Include three inputs, one invalid. Testing: Include expected output.
Lesson 26 arrays practice
Context: I finished the arrays exercises. Task: Create three exercises that read and change elements of shopping and score arrays. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 27 array mutation methods practice
Context: I finished the array mutation methods exercises. Task: Create three exercises using push, splice and slice with exact expected output. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 28 searching and sorting arrays practice
Context: I finished the searching and sorting arrays exercises. Task: Create three exercises that search and sort arrays of objects. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 29 iterating arrays practice
Context: I finished the iterating arrays exercises. Task: Create three exercises looping over arrays of objects with exact output. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 30 collection-based applications practice
Context: I finished the collection-based applications exercises. Task: Specify two small collection applications (contacts, inventory) with operations and expected output. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 31 forEach and callbacks practice
Context: I finished the forEach and callbacks exercises. Task: Create three forEach exercises that print and total data. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 32 map transformations practice
Context: I finished the map transformations exercises. Task: Create three map exercises that reshape arrays of objects. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 33 filter, some and every practice
Context: I finished the filter, some and every exercises. Task: Create three filtering exercises with combined conditions. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 34 reduce practice
Context: I finished the reduce exercises. Task: Create three reduce exercises: a total, a group-by and a count. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 35 array method pipelines practice
Context: I finished the array method pipelines exercises. Task: Create three pipeline exercises over sales and student data. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 36 JavaScript objects practice
Context: I finished the JavaScript objects exercises. Task: Create three exercises that build and update objects for a shop. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 37 dynamic keys and methods practice
Context: I finished the dynamic keys and methods exercises. Task: Create three exercises that loop over objects and use dynamic keys. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 38 nested objects and arrays practice
Context: I finished the nested objects and arrays exercises. Task: Create three exercises that summarise nested API-style data. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 39 references and copying practice
Context: I finished the references and copying exercises. Task: Create three exercises on immutable updates of nested state. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 40 data modelling practice
Context: I finished the data modelling exercises. Task: Specify two small domains for me to model, with the queries the model must support. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 41 destructuring practice
Context: I finished the destructuring exercises. Task: Create three exercises that use destructuring on API-style responses. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 42 spread and rest syntax practice
Context: I finished the spread and rest syntax exercises. Task: Create three exercises that update state immutably with spread. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 43 optional chaining practice
Context: I finished the optional chaining exercises. Task: Create three exercises that read partial API responses safely. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 44 nullish coalescing and default values practice
Context: I finished the nullish coalescing and default values exercises. Task: Create three exercises that normalise options objects. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 45 Sets and Maps practice
Context: I finished the Sets and Maps exercises. Task: Create three exercises that count, group and de-duplicate data with Set and Map. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 46 scope practice
Context: I finished the scope exercises. Task: Create three exercises that fix scope mistakes. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 47 lexical scope and the scope chain practice
Context: I finished the lexical scope and the scope chain exercises. Task: Create three exercises that trace scope chain lookups. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 48 closures practice
Context: I finished the closures exercises. Task: Create three exercises that use closures for private state and factories. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 49 hoisting and the temporal dead zone practice
Context: I finished the hoisting and the temporal dead zone exercises. Task: Create three exercises about declaration order. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Lesson 50 execution contexts and the call stack practice
Context: I finished the execution contexts and the call stack exercises. Task: Create three exercises that trace call order and fix recursion. Constraints: Fictional data and exact expected output. Expected behaviour: Each exercise has tests I can run. Testing: Put the solutions in a separate hidden section.
Guided learning
Lesson 1 Walk me through running code
Context: I have never run code before.
Task: Guide me step by step to run `console.log("Hello")` in my browser's developer console.
Constraints: Assume Chrome or Firefox on a laptop. One step per message; wait for me to confirm.
Expected behaviour: I see Hello printed in the console.
Testing: Ask me to describe what I see after each step.Lesson 2 Build a greeting program
Context: I can use console.log and const. Task: Guide me to write a program that prints a three-line greeting using two constants. Constraints: Give one instruction at a time and wait for my code. Point out mistakes with questions, not corrections. Expected behaviour: My program prints three greeting lines built with +. Testing: Ask me to run my code and paste the output after each step.
Lesson 5 Build a debugging habit
Context: I tend to change lots of code when something breaks. Task: Give me a short checklist and a practice routine to build a disciplined debugging habit. Constraints: Practical, under 200 words. Expected behaviour: I follow the same steps every time. Testing: Give me one practice bug to try the checklist on.
Planning
Lesson 15 Rules to plan
Context: I want to write a decision program for a cinema discount. Task: Help me write the rules in plain language and a decision table before any code. Constraints: No code until I approve the table. Expected behaviour: Every combination has an outcome. Testing: Ask me which outcomes surprised me.
Project development
Project 1 Interactive Tip Calculator
Context: I am completing the academy's Tip Calculator, stage 2. Task: explain why splitAmount(89.1, 1) can return 89.11 without Math.round. Constraints: explain floating point in plain language; do not rewrite my function. Expected behaviour: I can explain the bug and fix it myself. Testing: suggest two more totals that would expose it.
Project 1 Interactive Tip Calculator
Context: My validateInputs function passes the visible tests. Task: list boundary inputs I should test for bill, tip and people. Constraints: do not write the implementation. Expected behaviour: every rule is tested just inside and just outside its limit. Testing: give each case as input and expected ok value.
Project 1 Interactive Tip Calculator
Context: I want to add preset tip buttons. Task: help me plan the change. Constraints: keep tip.js free of page code; existing tests must pass. Expected behaviour: a button fills the tip field and recalculates. Testing: describe an acceptance test for one button.
Project 9 Shopping Cart Price Calculator
Context: I am building the academy's Shopping Cart (Stage 8, validation). Task: review my parseQuantity function for edge cases. Constraints: do not rewrite the function; list inputs I have not handled and the output each should produce. Expected behaviour: whole numbers 0–99 accepted, everything else rejected with a message. Testing: give each edge case as a test I can add to tests.json.
Project 9 Shopping Cart Price Calculator
Context: My cart total is $0.01 off for some carts. Task: help me find where rounding happens and whether it is applied consistently. Constraints: ask for my totals() function before suggesting changes. Expected behaviour: all amounts rounded to cents once per step. Testing: suggest two carts that would expose the problem.
Project 9 Shopping Cart Price Calculator
Context: I want to add BULK20 (20% off when the subtotal is at least $100). Task: help me plan the change with tests first. Constraints: keep cart.js free of DOM code; existing tests must still pass. Expected behaviour: boundary at exactly $100. Testing: list the tests to write before the implementation.
Refactoring
Lesson 2 Replace repeated numbers
Context: My program repeats the number 60 and the number 7 in several places. Task: Show me how storing them in named constants makes the program easier to change. Constraints: Keep my program's output identical. Explain each change in one sentence. Expected behaviour: Changing one constant updates every result. Testing: Show the output before and after to prove it is unchanged.
Testing
Lesson 2 Check my output
Context: I wrote a program that should print `7 minutes = 420 seconds`. Task: List what could make my output differ slightly from the expected text. Constraints: Focus on spaces, capitals and quotes. Do not rewrite my code. Expected behaviour: I can check my own output character by character. Testing: Give me a checklist I can tick off.
Lesson 4 Check log levels
Context: An exercise checks both the text and the level of my console messages. Task: Explain why a test might check the log level as well as the text. Constraints: Two short paragraphs. Expected behaviour: I understand why level matters for monitoring. Testing: Give one example of a production problem caused by the wrong level.