Practice and reinforce the concepts from Lesson 11
In this debugging challenge, you will practice fundamental JavaScript concepts including console output, alerts, prompts, variables, operators, control flow, loops, and functions. These exercises will test your understanding of core programming concepts.
What you'll do: Open the project and familiarize yourself with the interface
Time needed: 5 minutes
⚠️ Important: Before You Start DO NOT DELETE the existing files in the template:
- Package files
- Any other files you didn't create
ONLY EDIT the necessary files.
Time needed: 10 minutes
Basic Task:
If you have done it correctly, it should look like this:
Advanced Task: Create a simple greeting system:
tip Helpful Hint
Use alert(prompt("Reply:"))
to chain prompt and alert in one line
If you have done it correctly, it should look like this:
Time needed: 15 minutes
Basic Task: Create a simple introduce yourself app
name
without valueage
without valueIf you have done it correctly, it should look like this:
Assuming your name is Tom and age is 17.
Advanced Task: Introduce a second person using the same variables
tip Variable Reassignment This exercise teaches you how to reuse variables by reassigning new values to them
If you have done it correctly, it should look like this:
Assuming the other person's name is Holly and age is 14.
Time needed: 15 minutes
Basic Task: Make a calculator that adds two numbers
num1
and prompt the first numbernum2
and prompt the second numberanswer
and add up the 2 numberstip Common Issue
Remember to convert prompt inputs to numbers using the +
operator or Number()
function
If you have done it correctly, it should look like this:
Assuming the first number is 3 and the second number is 2.
Advanced Task: Also multiply the 2 numbers
If you have done it correctly, it should look like this:
Assuming the first number is 3 and the second number is 2.
Time needed: 20 minutes
Task: Create an app that tells us our grades according to our marks
Range | Grade |
---|---|
<40 |
G |
<50 |
D |
<65 |
C |
<75 |
B |
<100 |
A |
marks
and prompt with the message "Marks:"tip Conditional Logic
Use if...else if
statements to check the grades. Start checking from the lowest grade and work your way up.
If you have done it correctly, it should look like this:
Assuming the mark is 80.
Time needed: 10 minutes
Task: Create a multiplication table using a for loop
tip Loop Structure
Use for(let i = 1; i <= 10; i++)
and log i * 10
inside the loop
If you have done it correctly, it should look like this:
Time needed: 15 minutes
Task: Create a function that multiplies a number by 5
multiple5
with a parameter called number
answer
and set the value to multiply number by 5multiple5
with the parameter as a prompt for a numbertip Function Call
Create function multiple5(number)
and call it with multiple5(+prompt("Enter a number:"))
. The +
converts the prompt string to a number.
If you have done it correctly, it should look like this:
Make sure your Debugging Challenge projects include:
+
operator before prompt: +prompt("Enter number:")
Number()
function: Number(prompt("Enter number:"))
alert()
with parentheses=
when reassigning valuesℹ️ Info Project Submission Total time needed: Approximately 90 minutes
When you have completed your "Debugging Challenge A" projects, submit them using the link below:
Make sure to test all functionality and verify console outputs before submitting to ensure all debugging challenges are working properly!