Are function expressions really anonymous after all..?

Hey,

I’m at the Functions: Function expressions section of the Learn JS course. I’ve been reading about function expressions and anonymous functions, but now I’m confused about the reasoning behind function expressions.

I understand that a function expression is defined like so:

const calculateArea = function(width, height) {
    const area = width * height;
    return area;
}

// or
const sayHi = name => return `'Hello, ${name}!'` 

Either way, the function expression holds an anonymous function because the function identifier is ommited.

However, the way I see this, is that there is still an identifier, i.e. the const identifier. That means that I can still call either of these functions anywhere (well, not really because function expressions are not hoisted, but you get my point), i.e.:

console.log(sayHi());

To me, a truly anonymous function is a function that is passed as an argument to another function, and that can’t be called anywhere else, i.e. has no identifier, like so:

//React example
const [count, setCount] = useState(100);

// There is no identifier (pointer) I can call for this anonymous function argument
setCount(prevCount => prevCount + 1);

Anyways, I guess my question is, are function expressions really anonymous after all…?

Thanks for helping me clarify this :blush:.