diff options
author | Adam Brenecki <adam@brenecki.id.au> | 2013-08-15 20:33:44 +0930 |
---|---|---|
committer | Adam Brenecki <adam@brenecki.id.au> | 2013-08-15 20:33:44 +0930 |
commit | 05c3ca90447e6f63fa02847468e8a95f250fbe50 (patch) | |
tree | 29c8f47f03eb0e097886ef3590f74a0ee6629f03 | |
parent | 6ff1d84385206ff1e3901e863c296f8ce329cc31 (diff) |
[javascript] Remove anonymous function assignment example. ref #215
-rw-r--r-- | javascript.html.markdown | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/javascript.html.markdown b/javascript.html.markdown index 9b87b022..25777578 100644 --- a/javascript.html.markdown +++ b/javascript.html.markdown @@ -219,17 +219,9 @@ function myFunction(){ } setTimeout(myFunction, 5000) -// Functions can also be defined "anonymously" - without a name: -var lowerFunction = function(thing){ - return thing.toLowerCase() -} -lowerFunction("Foo") // = "foo" -// (note: we've assigned our anonymous function to a variable - if we didn't, we -// wouldn't be able to access it) - -// You can even write the function statement directly in the call to the other -// function. -setTimeout(function myFunction(){ +// Function objects don't even have to be declared with a name - you can write +// an anonymous function definition directly into the arguments of another. +setTimeout(function(){ // this code will be called in 5 seconds' time }, 5000) |