Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #30110
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Can somebody explain this code |
| Date | 2016-03-24 20:30 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2380128.LjnWGdRavf@PointedEars.de> (permalink) |
| References | <ncv2un$mlp$1@dont-email.me> |
Tony Johansson wrote:
> I know that functions behave much like variables such as
> var myFunc = function() { alert("This is my anonymous function");}
A misconception. Instead, the variable “myFunc” is being declared, and
initialized with (i.e., being assigned as first value) a reference to an
object, a Function instance. That object’s “name” property has the value ""
(as inherited from the Function prototype object); it is an anonymous
function as it was created with what is commonly called an “anonymous
function expression” (AFE). [The right-hand side is equivalent to a
“lambda” expression, e.g. in Python.]
It is *functionally* equivalent to
var myFunc;
myFunc = function () { alert("This is my anonymous function"); };
(In that case, “myFunc” is assigned the “undefined” value first.)
<http://www.ecma-international.org/ecma-262/6.0/#sec-variable-statement>
<http://www.ecma-international.org/ecma-262/6.0/#sec-function-instances-name>
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Can somebody explain this code "Tony Johansson" <johansson.andersson@telia.com> - 2016-03-23 22:51 +0100
Re: Can somebody explain this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-24 20:30 +0100
Re: Can somebody explain this code Aleksandro <aleksandro@gmx.com> - 2016-03-24 20:19 -0300
Re: Can somebody explain this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-27 22:44 +0200
Re: Can somebody explain this code Aleksandro <aleksandro@gmx.com> - 2016-03-27 18:22 -0300
Re: Can somebody explain this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-28 01:07 +0200
Re: Can somebody explain this code Aleksandro <aleksandro@gmx.com> - 2016-03-27 20:26 -0300
Re: Can somebody explain this code Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-05-04 05:51 +0200
Re: Can somebody explain this code "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-05-04 08:55 +0200
Re: Can somebody explain this code Aleksandro <aleksandro@gmx.com> - 2016-05-07 13:02 -0300
csiph-web