What will happen if a return statement does not have an associated expression?

What will happen if a return statement does not have an associated expression?
A. It returns the value 0
B. It will throw an exception
C. It returns the undefined value
D. It will throw an error
 
Answer: c
Explanation: A function without a return statement will return a default value. If the return statement does not have an associated expression then it returns an undefined value.
 

Tìm kiếm

Back
Top