0

How to call demo function globally??

i have demo named function which is in another function. i want to call this function as globally.. (JavaScript) init: function(){ demo: function(){ //code } }

28th Sep 2022, 10:42 AM
Bharat Bhushan
Bharat Bhushan - avatar
3 Réponses
+ 1
self executing function A = {foo:(function(){ bar:(function(){ console.log("bar") })()})() } A.foo or return the inside function function outside(){ function inside(){ console.log("hello") } return inside() } outside() // or if it is in a javascript object: B = {bar: function outside(){ function inside(){ console.log("Hi") }return inside()}} B.bar()
28th Sep 2022, 12:22 PM
Bob_Li
Bob_Li - avatar
+ 3
Please TAG ONLY THE RELEVANT PROGRAMMING LANGUAGE. You could return the inner function.
28th Sep 2022, 11:11 AM
Lisa
Lisa - avatar
0
Bob_Li Lisa Thanks
8th Oct 2022, 9:36 PM
Bharat Bhushan
Bharat Bhushan - avatar