SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Jan 11, 2007, 06:54 #1
- Join Date
- Jul 2006
- Location
- Philippines
- Posts
- 936
- Mentioned
- 3 Post(s)
- Tagged
- 0 Thread(s)
calling another function inside a function? how?
hi guys i'm very noobs on javascript
how do you call a function inside a function?
can you show me a simple but complete snippet of codes?
thank you very much.
-
Jan 11, 2007, 07:05 #2
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can only access a nested function within its containing function. Variables defined in the outer functions body are accessible from the inner function, but not the other way around. I hope that made sense...
-
Jan 11, 2007, 07:15 #3
-
Jan 11, 2007, 08:20 #4
- Join Date
- Jul 2006
- Posts
- 151
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
On the other hand, you can do this:
Code:function foo() { bar(); } function bar() { return; }
Last edited by dwees; Jan 11, 2007 at 10:31. Reason: I doubt someone inexperienced in Javascript wants to use a nested function.
-
Jan 11, 2007, 08:22 #5
- Join Date
- Jan 2005
- Location
- Too far up north
- Posts
- 1,566
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
That is not a nested function though
-
Jan 11, 2007, 08:50 #6
- Join Date
- Nov 2004
- Location
- Nelson BC
- Posts
- 2,310
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You're right it isn't but it's probably what the OP wants.
Bookmarks