[javascript] Remove anonymous function assignment example. ref #215

This commit is contained in:
Adam Brenecki 2013-08-15 20:33:44 +09:30
parent 6ff1d84385
commit 05c3ca9044

View File

@ -219,17 +219,9 @@ function myFunction(){
} }
setTimeout(myFunction, 5000) setTimeout(myFunction, 5000)
// Functions can also be defined "anonymously" - without a name: // Function objects don't even have to be declared with a name - you can write
var lowerFunction = function(thing){ // an anonymous function definition directly into the arguments of another.
return thing.toLowerCase() setTimeout(function(){
}
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(){
// this code will be called in 5 seconds' time // this code will be called in 5 seconds' time
}, 5000) }, 5000)