InterviewSolution
| 1. |
Can A Javascript Constructor Return A Primitive Value (e.g. A Number Or A String)? |
|
Answer» No. A JAVASCRIPT constructor can only RETURN an OBJECT. When no return value is specified, it RETURNS an INSTANCE of itself. If an object is specified as the return value, then that object is the return value. If any value other than an object is specified as the return value, then it returns an instance of itself. No. A JavaScript constructor can only return an object. When no return value is specified, it returns an instance of itself. If an object is specified as the return value, then that object is the return value. If any value other than an object is specified as the return value, then it returns an instance of itself. |
|