You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varp=newPromise(function(resolve,reject){resolve(42);});p.then(functionfulfilled(msg){foo.bar();console.log(msg);// never gets here :(},functionrejected(err){// never gets here either :(});
I get a ReferenceError: foo is not defined instead of TypeError. Is it a typo?
As I understood, the error will be caught anyway because of the spec changes, so running the code in Chrome will give Uncaught (in promise) ReferenceError: foo is not defined. But where is the TypeError?
The text was updated successfully, but these errors were encountered:
You're correct, should have been ReferenceError. I think this was a missed detail when the code snippet was refactored from an earlier version. Will address in second edition.
https://github.com/iDanbo/You-Dont-Know-JS/blob/master/async%20%26%20performance/ch3.md#swallowing-any-errorsexceptions
I get a
ReferenceError: foo is not defined
instead ofTypeError
. Is it a typo?As I understood, the error will be caught anyway because of the spec changes, so running the code in Chrome will give
Uncaught (in promise) ReferenceError: foo is not defined
. But where is theTypeError
?The text was updated successfully, but these errors were encountered: