Here, lastname const variable is declared later for understanding purpose. it is not accessed from the top in hoistedName obvisously with a hoisting concept. But how can it be read from a function inside?
const hoistedName = "Adam" + " " + lastname // cannot read lastname
var hello = (name) => {
const fullname = name + " " + lastname // can read lastname delared afterward
console.log(`hello ${fullname}`)
}
const lastname = "Smith" // variable declared
hello("John") // => hello John Smith
console.log(hoistedName) // => Adam null