Javascript unexpected identifier but works in console

When I create a script as such

    async function a(){
        return 'a';
    }
    console.log(undefined || await a());

The browser (Brave & Edge) gives the error Uncaught SyntaxError: missing ) after argument list

Funnily enough, copy and pasting the exact same code into the debug console runs without a complaint.

Any explanation?