SOURCE

function out(myname){
    var i = 0;
    function inOutAdd (){
        return i++;
    };
    function inOutLog(){
        console.log(i);
        console.log(this.name);
    }
    return {
        name:myname,
        add:inOutAdd,
        log:inOutLog
    }
    
}
var one = out('one');
var two = out('two');

one.add();
one.log();
two.log();

two.add();
one.log();
two.log();

var i = 1000;
function test(i){
    console.log(i);
}
test(2222);
test(i);

console 命令行工具 X clear

                    
>
console