423,944 views
36 votes
36 votes
How to call a variable from another function in javascript

User Jassi Oberoi
by
2.3k points

1 Answer

4 votes
4 votes

Answer:

For simplest case, passing variables to another function might be the best approach to this problem. Return the value you wish to use in functionOne, then call functionOne within functionTwo and place the result into a fresh var. This should enable you to use the var declared in functionOne, within functionTwo.

Step-by-step explanation:

User OriolJ
by
2.9k points