MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1// Demonstrate function.name property
2
3function myFunction() {
4 return "Hello";
5}
6
7function anotherFunction(x, y) {
8 return x + y;
9}
10
11console.log("Function names:");
12console.log("myFunction.name = " + myFunction.name);
13console.log("anotherFunction.name = " + anotherFunction.name);
14
15// Anonymous function has empty name
16let anon = function() { return 42; };
17console.log("anon.name = '" + anon.name + "' (empty for anonymous functions)");
18
19// Named function expression
20let named = function namedFunc() { return 100; };
21console.log("named.name = " + named.name);