📜  javascript代码示例中的闭包是什么

📅  最后修改于: 2022-03-11 15:03:57.498000             🧑  作者: Mango

代码示例6
//Closures are the inner functions that are embedded in parent function
function getName(){
    // print name function is the closure since it is child function of getName
     function printName(){
         return 'Kevin'
     }
     // return our function definition
     return printName;
}

const checkNames = getName();
console.log(checkNames());