Is there a variable promotion in ES6's let,const?

this is written on MDN, and Ruan Yifeng"s introduction to es6 also says that he will not promote introduction to ECMAScript 6

.
in ECMAScript 2015, the let binding is not constrained by variable promotion, which means that the let declaration is not promoted to the top of the current execution context.

however, today, I heard someone in the communication group say that they have actually improved. I searched them and found that there are many blogs on the Internet who say that they have actually improved, for example: let deeply understand-is there a variable improvement in let?
Are variables declared with let or const not hoisted in ES6?

so I would like to ask you, is there any variable promotion in the let,const of ES6?

Nov.19,2021
The create process of

let is promoted, but initialization is not promoted.
both creation and initialization of var have been promoted.
function's "create", "initialize" and "assign" have been promoted.
has been solved, no one answered this community too. Abandoned pit


"creation process is promoted, initialization is not promoted" is OK, but it is not in line with the official definition. Wouldn't it be better to directly follow the official explanation that "if there is no ascension, there is TDZ"? why do we have to rely on ascension?


of course not! It will be in a temporary dead zone, and you won't get the desired value until you initialize it.


neither let nor const will be promoted, just experiment with the following code:

console.log(bbbb); // undefined
var bbbb = 10; 

console.log(aaaaa); // Uncaught ReferenceError: aaaaa is not defined
let aaaaa = 10;

console.log(cccc); // Uncaught ReferenceError: cccc is not defined
const cccc = 10;

say the result directly: there is a variable improvement.
but why does the following situation report an error:

function foo(){
    console.log(_var);
    const _var = '_var';
}

just because there is a temporary dead zone, it has nothing to do with whether the variable is promoted or not.
look at the picture and talk
image.png


variables defined by let and const are promoted, but they are not initialized, cannot be referenced, and do not have an initial value of undefined, as with variables defined by var.
when you enter the scope of the let variable, the storage space is created for it immediately, but it is not initialized.

variable assignment can be divided into three stages:

  1. create variables, open up space in memory
  2. initialize variables, initialize variables to undefined
  3. real assignment

about let, var and function:

  • let's "creation" process is promoted, but initialization is not promoted.
  • both creation and initialization of var have been promoted.
  • function's "create", "initialize" and "assign" have been promoted.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bef270-31c73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bef270-31c73.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?