I have found myself writing a lot of functions comprising of nested functions.
I like to use this pattern when doing so, as I find them easy to find again using the eclipse outline view
var outer_func = function(){
var inner_func1 = function(){
//code
}
var inner_func2 = function(){
//code
}
}
My question: Is there any scoping differences if I drop the var keyword from the nested/inner functions?
thanks for any advice.
If you leave off the inner var keyword, then you will be creating global functions named inner_func1 and inner_func2. Keep the var.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With