Functions
A function is a recipe you can reuse. It takes inputs called parameters and sends back a result with return.
function add(a, b) { return a + b; } defines it. add(2, 3) calls it and gives back 5.
The checks call your functions with different numbers, so they test that your code works, not that it matches one exact answer.
Example
function greet(name) {
return "Hi, " + name + "!";
}
console.log(greet("Asha"));
console.log(greet("Leo"));
Without
return, a function gives back undefined. The checks will tell you if that happens.Your tasks
0 of 3 done- add(2, 3) returns 5Expected 5, got undefined
- add(-4, 10) returns 6Expected 6, got undefined
- Write double(n), which returns n times 2You used "double", but the computer doesn't know that name yet. Check the spelling (capital letters count), or create it first with let.
Tutor
The tutor guides you toward the answer instead of handing it over. It uses your own Claude usage.
Quick check
What does a function give back if it has no return?
undefined
No problems found. Unclosed tags, missing semicolons and errors show up here in plain words.