This JavaScript code defines a recursive function called `factorial` that calculates the factorial of a number. The code then calls the `factorial` function with the argument 5, printing the result `120` to the console.
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
Explain this JavaScript snippet.

### Input:
`javascript
function factorial(n) {
    if (n === 0) return 1;
    return n * factorial(n - 1);
}
console.log(factorial(5));
`

### Response:
This JavaScript code defines a recursive function called `factorial` that calculates the factorial of a number. The code then calls the `factorial` function with the argument 5, printing the result `120` to the console.<|im_end|>