Some Questions about eval

  node.js, question
var a = eval("()=>{return ('../assets/a.png')}")
 console.log(a);  // function ()=>{return ('../assets/a.png')}
var a = eval("function(){return ('../assets/a.png')}")
 //uncaught syntaxerror: unexpected token (because anonymous methods cannot be generated directly)
var a = eval("function foo(){return ('../assets/a.png')}")
 console.log(a);  // undefined

I don’t quite understand the third one. What is “undefined” after “eval”? The A of the first eval can be correctly assigned.

var a = eval("(function foo(){return ('../assets/a.png')})")
 console.log(a);

eval(string)

Return Value: The value (if any) obtained by calculating string