such as the title: often see other people writing code like to return the function as a return value
    var res = test()
    console.log((res.next())())
    function test() {
        var a = 10;
        return {
            next(){
                return function () {
                    return a+1
                }
            }
        }
    }
    I think writing like this will solve the problem:
var res = test()
console.log(res)
function test() {
    var a = 10;
    return a+1
}   what are the advantages of the first way of writing? What are the usage scenarios?
