See below for what happened in Firefox and Chrome’s console:
> var f = function() {}
undefined
> f.name = 'f'
"f"
> f.name
""
> f.id = 1
1
> f.id
1
Why f.name = 'f' is a no-op?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Probably depends on the implementation.
In some implementations, the
nameproperty of a function object is used as the function’s name if it has one. This is likely read-only in these cases.This is a non-standard feature.
for example:
In Firefox and Chrome, if I try to modify it, it won’t change…
nameproperty.Here are some key points from the docs…