I know just one way to prove that variable hoisting do happen with let or const despite of same Uncaught ReferenceError.
- if variable is hoisted in
let or const declaration, the variable must have been declared, that means it has already allocated a memory space
- if we can prove that the variable has occupied a memory space before accessing it (rather before code execution), that means the variable is hoisted
We can use a browser dev-tools to check for the same, let us add a debugger in the first line to pause the execution before accessing the variable declared with let
debugger;
console.log(y)
y=10;
let y;
When this is executed in console tab, it redirects to the source tab where we can see the variable y already allocated a memory space that's why it is shown under Script in the Scope section on the right side (denoting lexical scope of let declaration for variable y)

However, this will throw the same error: Uncaught ReferenceError: y is not defined in line 2, since it is not defined.
But the point is we have proved that the variable has allocated a memory space before execution, hence variable hoisting do occur in let or const declaration
Let me know your views. I would like to know more ways to prove the same. So please feel free to add your points.