xxx is a variable. When you try to log it via console.log(xxx) it can not access to the variable which is not declared. To make it work you have to define the xxx variable.
const xxx = 'something' // variable declaration
function myFunction() {
console.log(xxx)
}
myFunction()