From 05c3ca90447e6f63fa02847468e8a95f250fbe50 Mon Sep 17 00:00:00 2001 From: Adam Brenecki Date: Thu, 15 Aug 2013 20:33:44 +0930 Subject: [javascript] Remove anonymous function assignment example. ref #215 --- javascript.html.markdown | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'javascript.html.markdown') 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) -- cgit v1.2.3