Constants are block-scoped, much like variables defined using the let statement.
From this MDN article.
Since you wrapped bar
inside a block of braces, its definition is relative to that block. And because you have another bar
declaration inside of that block, despite being after the call to it, the compiler will attempt to use this newly defined bar
instead of the passed-in parameter. Rename them as separate parameters to mitigate confusion, since one can assume they are holding different data because of your declaration.