January 2020
Intermediate to advanced
470 pages
11h 13m
English
3.1. Uninitialized object? The key is that we didn't wrap the returned object in parentheses, so JavaScript thinks the braces enclose the code to be executed. In this case, type is considered to be labeling a statement, which doesn't really do anything: it's an expression (t) that isn't used. Due to this, the code is considered valid, and since it doesn't have an explicit return statement, the implicit returned value is undefined. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label for more on labels, and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions#Returning_object_literals for more on returning objects. ...
Read now
Unlock full access