Question · JavaScript and TypeScript course · Module 1: JavaScript Basics
ASI Trap with return
What will a function return when return is on a separate line from the returned object?
function f() { return { name: 'Rex' } }
Answer options
- null
- Object { name: 'Rex' }
- undefined - ASI will insert a semicolon after return
- SyntaxError
Show the answer
Correct answer:
- undefined - ASI will insert a semicolon after return