Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do we need to change how we describe const funcName = function funcName() #18

Open
tildeee opened this issue Jun 1, 2021 · 0 comments

Comments

@tildeee
Copy link
Collaborator

tildeee commented Jun 1, 2021

From reading I've done in the past, technically this is an anonymous function, and it's only through interpreter convention that it looks for the assignment to a variable to try an associate a name with the function, largely to aid with debugging. We can see in other situations that (passing a new function expression as an expression to another function) that the name property will not be populated. Consider:

const pn = function(fn) { console.log(fn.name); };
pn(pn);  // prints "pn". Not standard, but everything does it 🤷 
pn(function(){});  // prints ""

Originally posted by @anselrognlie in #7 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant