JavaScript: Is it okay to give a function the same name as the function expression?

Viewed 122

In JavaScript, if I create a function expression like:

var foo = function foo() {
  return 'Hello world!';
}

Is this okay? Will there be any problems that occur? Or should I do:

var foo = function baz() {
  return 'Hello world!';
}
2 Answers
Related