Was working on some js code performance and saw this approach:
window.sample = {
foo: function foo(a,b){
// code goes here
}
bar: function bar(a,b){
// code goes here
}
}
is there any reason why you would decelerate the function name after the word “function” ?
dose it help to debug?
is it good or bad or just unnecessary?
instead of assigning an anonymous function to the foo and bar properties, they are assigning named functions.
it can be helpful for debugging: the only difference this makes, that i know of, is that you will see the names of the functions show up in the call stack instead of “javascript anonymous function”