On the default value of js function

Why do the following two writing methods produce two different results? Ask the boss for a detailed answer. Personally, I think it is related to the block-level scope of function parameters. But it"s still weird to understand, and it"s weird to look at it with chrome debugger. Why is the last input x output based on Block? Thank you very much ~

function test (x, y = function t () { x = 2 }) {
  // var x
  y()
  console.log(x) // 2
}
debugger
test()
Apr.08,2022
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-1ebe4b9-29c3.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-1ebe4b9-29c3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?