Which fix removes the bug?
function greet(name) {
return 'Hi ' + name;
}
console.log(greet());
- Give name a default value
- Rename the function param
- Return a template literal
- Declare greet with const
A missing argument is undefined, which concatenates into the literal text 'Hi undefined'.
Play Problem Solving ▸