JavaScript Functions Practice
Functions turn repeated logic into reusable code. Practice parameters, return values, function calls, and arrow function syntax with short beginner questions.
JavaScript function practice helps you connect inputs, body logic, and return values. A function is easier to understand when you trace one call from argument to result.
For each question, identify the parameters, plug in the arguments, and decide what value is returned. Then compare regular function syntax with arrow function syntax.
- Parameters, arguments, and calls
- return values and undefined
- Arrow functions and expression bodies
Example practice questions
Try these samples, then continue into the JavaScript Practice Labfor guided browser-based practice.
What keyword sends a value back from a function?
Answer: return
In function add(a, b), what are a and b?
Answer: Parameters
What does add(2, 3) represent?
Answer: A function call with two arguments
Which syntax creates a simple arrow function?
Answer: const add = (a, b) => a + b;
What happens when a function has no return statement?
Answer: It returns undefined.
What is returned by const double = (n) => n * 2; double(4)?
Answer: 8
What is the difference between a parameter and an argument?
Answer: A parameter is in the function definition; an argument is passed into the call.