You just can't get away from coercions in JS comparisons. But the important part is to see that before the comparison, a coercion occurs, from whatever type x currently is, to boolean. Since the Boolean(.) function always returns a value of type boolean, the = vs = in this snippet is irrelevant they'll both do the same thing. var awesomeFunction = function someName ( coolThings ) An anonymous function doesn't have an identifier to use to refer to itself from inside itself-for recursion, event unbinding, etc.Ĭompare the anonymous function expression form to: Why? Because the inferred name is a metadata string value, not an available identifier to refer to the function. If you pass a function expression as an argument to a function call, for example, no name inference occurs the name property will be an empty string, and the developer console will usually report "(anonymous function)".Įven if a name is inferred, it's still an anonymous function. However, name inference only happens in limited cases such as when the function expression is assigned (with =). So even an anonymous function expression might get a name. That value is generally used by developer tools when inspecting a function value or when reporting an error stack trace. The name property of a function will reveal either its directly given name (in the case of a declaration) or its inferred name in the case of an anonymous function expression.
To restore the repository, download the bundle getify-You-Dont-Know-JS_-_08-26-15.bundle and run: git clone getify-You-Dont-Know-JS_-_08-26-15.AwesomeFunction. This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 4.0 Unported License. The materials herein are all (c) 2013-2017 Kyle Simpson. ContributionsĪny contributions you make to this effort are of course greatly appreciated.īut PLEASE read the Contributions Guidelines carefully before submitting a PR. Some of those courses are also distributed on other platforms, like Pluralsight,, and O'Reilly Safari Online.
I teach courses through Frontend Masters, like my Deep JavaScript Foundations workshop. I also have some JS training material available in on-demand video format. If you like this content and would like to contact me regarding conducting training on these, or other various JS/HTML5/node.js topics, please reach out to me through email: getify gmail Online Video Training
The content for these books derives heavily from a series of training materials I teach professionally (in both public and private-corporate workshop format): "Deep JavaScript Foundations", "Rethinking Async", and "ES6: The Right Parts" workshops. If you'd like to contribute financially towards the effort (or any of my other OSS work) aside from purchasing the books, I do have a patreon that I would always appreciate your generosity towards. If you like the content you find here, and want to support more content like it, please purchase the books once they are available for sale, through your normal book sources.
These books are being released here as drafts, free to read, but are also being edited, produced, and published through O'Reilly.
Please feel free to contribute to the quality of this content by submitting PR's for improvements to code snippets, explanations, etc. The first edition of the series is now complete. This is a series of books diving deep into the core mechanisms of the JavaScript language.