Q:

How hoisting works for classes?

The term hoisting in JavaScript class reference is: you first need to declare your class and then access it, otherwise code like the following will throw a ReferenceError:
const p = new Rectangle(); // ReferenceError
class Rectangle {}

In other references: all variable declarations are hoisted to the top of their scope regardless of where the actual declaration has been made.
However MDN says:
Hoisting is a term you will not find used in any normative specification prose prior to ECMAScript® 2015 Language Specification. Hoisting was thought up as a general way of thinking about how execution contexts (specifically the creation and execution phases) work in JavaScript. However, the concept can be a little confusing at first.
It looks hoist means a lot what I understand. However, it is weird to use something before declaration, but is it work differently for classes whereas class is also a type of function in JavaScript.

A:

Actually classes are hoisted as the variable binding is available in the whole scope, but they are not initialised.
Ref: Are variables declared with let or const not hoisted in ES6?

