Problems with es6 variables and scope

first give an example:: const testFun = () = > {

let testParams
const sonFun = () => {
    testParams = 3
}
console.log(testParams)

}
how can I console the value of testParams if I write it like this?

Mar.16,2021

first you have to execute the sonFun method before you can assign a value to testParams


you didn't perform this assignment at all

let testParams
const sonFun = () => {
    testParams = 3
}
sonFun()
console.log(testParams)

const testFun = () => {
        let testParams
        const sonFun = () => {
            testParams = 3
        }
        sonFun()
        console.log(testParams)
    }
    testFun()

let testParams
const sonFun = () => {
    testParams = 3
}
sonFun();
console.log(testParams)

the scope of this arrow function is probably not withdrawn in this code

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-1b37760-34461.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-1b37760-34461.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?