Scope problems related to the default value of es6- function

Code is extracted from getting started with es6

var x = 1;
function foo(x, y = function() { x = 2; }) {
  var x = 3;
  y();
  console.log(x);
}

foo() // 3
x // 1
There is a sentence in

.

Another internal variable x is declared inside the
function foo, which is not in the same scope as the first parameter x because it is not in the same scope

then I modified

var x = 1;
function foo(x, y = function() { x = 2; }) {
  let x = 3;                   //
  y();
  console.log(x);
}

my question is, since it is not the same scope, why can"t we declare x internally with let,
I know that variables cannot be repeatedly declared by let, but the answer says it is not the same scope

my question and guess:
does it not take into account the independent scope generated when the function has default parameters in the process of precompilation, so the duplicate definition is judged first?
feels strange, personal feeling: the compiler should declare the formal parameter x by let, so as to highlight the independent scope

Sep.08,2021

function foo(x, y = function() { x = 2; }) {
  let x = 3;                   //
  y();
  console.log(x);
}

the x declared by let here repeats with the formal parameter, not with var x = 1; repeats


var x = 1;
function foo(x, y = function() { x = 2; }) {
  var x = 3;
  y();
  console.log(x);
}

foo() // 3
x // 1
Another internal variable x is declared inside the
function foo, which is not in the same scope as the first parameter x because it is not in the same scope

reorganize. What I said before is still wrong. Correct the [[scope]]:
formal parameter declaration form of
foo. I think it is var x; let y = function () {x = 2}

.
go:x = 1;
1{
    y=function() {x = 2};   //xyx;yx
    2{
       
        var x = 3;       xxy    
    }
}
letx

parameter variables are declared by default, so you cannot declare them again with let or const.

  
Parameter xint2 and let x = 3 Why are they not in the same scope?
es6 parameter default value statement I don't know where to look at the local declaration of let (forget)
when I get to the default value, I will go to the let repeated declaration and throw
of error .
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-1ea6993-46b2e.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-1ea6993-46b2e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?