How to use nested functions in Node.js

1 Answer

0 votes
function xoo() {
    console.log("xoo()");
      
    function in_func() { // accessible only within xoo()
        return 871;
    }
      
    console.log("before return");
      
    return in_func();
}
    
console.log(xoo());
   
   
   
   
/*
run:
    
xoo()
before return
871
    
*/

 



answered May 31, 2022 by avibootz

Related questions

3 answers 237 views
2 answers 135 views
135 views asked May 22, 2022 by avibootz
1 answer 192 views
1 answer 166 views
1 answer 121 views
1 answer 156 views
156 views asked Feb 12, 2021 by avibootz
...