Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Javascript - Difference between function declarations

Current License: CC BY-SA 3.0

Post Revisions

13 events
when toggle format what by license comment
Aug 13, 2017 at 13:01 history edited Cœur CC BY-SA 3.0
spelling in title
Apr 13, 2017 at 9:22 vote accept hjalpmig
Apr 13, 2017 at 9:18 review Close votes
Apr 17, 2017 at 0:04
Apr 13, 2017 at 9:14 answer added Muhammad Qasim timeline score: 0
Apr 13, 2017 at 9:13 comment added Arg0n @Quentin Still not impossible to add the call inside. Code is usually modifiable. He does not need to put it outsite fun1 to be able to call it as you state. With your logic fun1 is impossible to call, since he does not call it with the shown code.
Apr 13, 2017 at 9:12 comment added Saurabh Tiwari What you do in the first case is an example of closure. Read about JavaScript closures and you should be clear about it
Apr 13, 2017 at 9:08 answer added m1kael timeline score: 0
Apr 13, 2017 at 9:07 comment added Quentin @Arg0n — It isn't called from inside fun1
Apr 13, 2017 at 9:04 answer added MysterX timeline score: 2
Apr 13, 2017 at 9:03 comment added Arg0n @Quentin Impossible from outside fun1, inside it's not.
Apr 13, 2017 at 9:03 comment added user3004449 Second example is better for re-usability. Now you can call function fun2 again in other functions.
Apr 13, 2017 at 9:02 comment added Quentin Well ... it is impossible to call fun2 in the first example.
Apr 13, 2017 at 9:01 history asked hjalpmig CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /