This question is usually asked in the context of a conversation about functions, namely the difference between arrow functions and regular ones, or when discussing the function execution context (this). So let's break down what hoisting is. Put simply, it is a mechanism of JavaScript that reads the file before execution and registers all variables and functions first. This makes it possible to reference them in code before they are declared. Let's look at how hoisting works with different entities in JS:
Var
In a real project you most likely won't run into var (unless it's ancient legacy code), but understanding how hoisting works in this case gives a broader understanding of the concept. In the example, during the first pass over the file the variable a was registered, and if you try to access it before its declaration, its value will be undefined.
Function declaration
In this case, hoisting registers both the function name and its body, so the function is available for use before its declaration. It is important to stress that this only works with Function Declaration and will not work with Function Expression.
Let and const
In fact, variables and constants declared with let and const are hoisted too. They are registered the same way as variables declared with var, but instead of being assigned undefined, let and const end up in the TDZ (Temporal Dead Zone). So when you try to access them before their declaration, you will get an error: ReferenceError.
The information above is quite enough for your interview answer to sound confident and for the interviewer to see that you understand this topic.