mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
[javascript] Remove anonymous function assignment example. ref #215
This commit is contained in:
parent
6ff1d84385
commit
05c3ca9044
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user