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 } }
3 ответов
+ 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()
+ 3
Please TAG ONLY THE RELEVANT PROGRAMMING LANGUAGE.
You could return the inner function.